sphinxsolution commited on
Commit
fa168b6
·
verified ·
1 Parent(s): a1d0fc5

Created app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Load model directly from Hugging Face Hub
5
+ model_name = "EleutherAI/gpt-neo-125M" # Replace with your model
6
+ generator = pipeline("text-generation", model=model_name)
7
+
8
+ def generate_text(prompt):
9
+ result = generator(prompt, max_length=50)
10
+ return result[0]["generated_text"]
11
+
12
+ demo = gr.Interface(
13
+ fn=generate_text,
14
+ inputs=gr.Textbox(lines=2, placeholder="Enter your prompt..."),
15
+ outputs="text",
16
+ title="Custom Hugging Face Model UI",
17
+ description=f"This UI interacts with the {model_name} model."
18
+ )
19
+
20
+ demo.launch()