Spaces:
Sleeping
Sleeping
Commit
·
d6e8010
1
Parent(s):
26d2810
lasting
Browse files
app.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
# Load the text generation model
|
5 |
model_id = "gpt2" # You can replace this with any model of your choice
|
6 |
generator = pipeline("text-generation", model=model_id)
|
7 |
|
@@ -11,15 +10,6 @@ def generate_text(prompt):
|
|
11 |
generated_text = response[0]['generated_text']
|
12 |
return generated_text
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
fn=generate_text,
|
17 |
-
input=gr.inputs.Textbox(lines=2, placeholder="Enter your prompt here..."),
|
18 |
-
output="text",
|
19 |
-
title="Text Generation",
|
20 |
-
description="Enter a prompt and the model will generate text based on it."
|
21 |
-
)
|
22 |
|
23 |
-
# Launch the interface
|
24 |
-
if __name__ == "__main__":
|
25 |
-
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
|
|
4 |
model_id = "gpt2" # You can replace this with any model of your choice
|
5 |
generator = pipeline("text-generation", model=model_id)
|
6 |
|
|
|
10 |
generated_text = response[0]['generated_text']
|
11 |
return generated_text
|
12 |
|
13 |
+
demo = gr.Interface(fn=generate_text, inputs="text", outputs="text")
|
14 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
|
|
|
|
|