remotikal commited on
Commit
8eeaa63
1 Parent(s): b692d26

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -1
app.py CHANGED
@@ -1,3 +1,21 @@
1
  import gradio as gr
 
2
 
3
- gr.load("models/TinyLlama/TinyLlama-1.1B-Chat-v1.0").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ from transformers import pipeline
3
 
4
+ # Load the model using Hugging Face's transformers library
5
+ model_name = "facebook/blenderbot-400M-distill" # Example model, replace with your desired model
6
+ nlp = pipeline("text-generation", model=model_name)
7
+
8
+ # Define the function to generate text
9
+ def generate_text(prompt):
10
+ response = nlp(prompt, max_length=50, num_return_sequences=1)
11
+ return response[0]['generated_text']
12
+
13
+ # Create a Gradio interface
14
+ iface = gr.Interface(fn=generate_text,
15
+ inputs="text",
16
+ outputs="text",
17
+ title="Hugging Face Model",
18
+ description="Generate text using a Hugging Face model.")
19
+
20
+ # Launch the interface
21
+ iface.launch()