Spaces:
Runtime error
Runtime error
AngelaKkkkkkkkk
commited on
Commit
•
325adf6
1
Parent(s):
e8122b5
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,16 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
4 |
-
|
5 |
|
6 |
-
|
|
|
|
|
|
|
7 |
|
|
|
|
|
|
|
|
|
8 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
|
4 |
+
# Load the model
|
5 |
+
generator = pipeline("text-generation", model="distilgpt2")
|
6 |
|
7 |
+
# Define the function for Gradio
|
8 |
+
def generate_text(prompt):
|
9 |
+
result = generator(prompt, max_length=50, num_return_sequences=1)
|
10 |
+
return result[0]["generated_text"]
|
11 |
|
12 |
+
# Create the Gradio interface
|
13 |
+
demo = gr.Interface(fn=generate_text, inputs="text", outputs="text", title="Simple LLM Chat")
|
14 |
+
|
15 |
+
# Launch the interface
|
16 |
demo.launch()
|