Yussifweb3 commited on
Commit
f759ca3
·
verified ·
1 Parent(s): 3d6f959

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -0
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()