Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
CHANGED
|
@@ -1,21 +1,15 @@
|
|
| 1 |
-
pip install transformers gradio
|
| 2 |
import gradio as gr
|
| 3 |
-
from transformers import pipeline
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
|
|
|
|
| 7 |
|
| 8 |
-
#
|
| 9 |
-
def generate_story(prompt):
|
| 10 |
-
story = generator(prompt, max_length=200, num_return_sequences=1)[0]['generated_text']
|
| 11 |
-
return story
|
| 12 |
-
|
| 13 |
-
# Create a Gradio interface
|
| 14 |
iface = gr.Interface(
|
| 15 |
-
fn=
|
| 16 |
-
inputs=gr.Textbox(label="Enter
|
| 17 |
-
outputs=gr.Textbox(label="
|
| 18 |
)
|
| 19 |
|
| 20 |
-
# Launch the
|
| 21 |
iface.launch()
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
+
# Function to echo user input
|
| 4 |
+
def echo_input(user_input):
|
| 5 |
+
return user_input
|
| 6 |
|
| 7 |
+
# Create Gradio interface
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
iface = gr.Interface(
|
| 9 |
+
fn=echo_input,
|
| 10 |
+
inputs=gr.Textbox(label="Enter some text", placeholder="Type something..."),
|
| 11 |
+
outputs=gr.Textbox(label="You entered")
|
| 12 |
)
|
| 13 |
|
| 14 |
+
# Launch the app
|
| 15 |
iface.launch()
|