Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Use an existing model from Hugging Face
|
5 |
+
model = pipeline("text-generation", model="gpt2") # Replace 'gpt2' with the model you want
|
6 |
+
|
7 |
+
def predict(text):
|
8 |
+
result = model(text, max_length=100)[0]["generated_text"]
|
9 |
+
return result
|
10 |
+
|
11 |
+
# Simple Gradio app
|
12 |
+
gr.Interface(fn=predict, inputs="text", outputs="text").launch()
|