AngelaKkkkkkkkk commited on
Commit
e8122b5
1 Parent(s): 623059e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -25
app.py CHANGED
@@ -1,29 +1,8 @@
1
  import gradio as gr
2
- from transformers import pipeline
3
 
4
- # Define the models you want to include in the dropdown
5
- models = {
6
- "GPT-2": "gpt2",
7
- "DistilGPT-2": "distilgpt2",
8
- "BERT Base Uncased": "bert-base-uncased",
9
- "T5 Small": "t5-small"
10
- }
11
 
12
- # Function to generate the response
13
- def generate_response(model_name, user_input):
14
- generator = pipeline(task="text-generation", model=model_name)
15
- output = generator(user_input, max_length=50)[0]["generated_text"]
16
- return output
17
 
18
- # Create the Gradio interface
19
- interface = gr.Interface(
20
- fn=generate_response,
21
- inputs=[gr.inputs.Dropdown(list(models.keys()), label="Select Model"),
22
- gr.inputs.Textbox(label="Enter your text")],
23
- outputs=gr.outputs.Textbox(label="Model Output"),
24
- title="Chat with LLMs",
25
- description="Select a model and enter a prompt to chat with different large language models."
26
- )
27
-
28
- # Launch the interface
29
- interface.launch()
 
1
  import gradio as gr
 
2
 
3
+ def greet(name):
4
+ return "Hello " + name + "!"
 
 
 
 
 
5
 
6
+ demo = gr.Interface(fn=greet, inputs="text", outputs="text")
 
 
 
 
7
 
8
+ demo.launch()