research14 commited on
Commit
b934ee9
·
1 Parent(s): 1b215c9

added test for models

Browse files
Files changed (1) hide show
  1. app.py +10 -17
app.py CHANGED
@@ -1,23 +1,16 @@
1
  import gradio as gr
2
 
3
- def search(query, selected_strategies):
4
- # Add your search logic here
5
- results = ["Result 1", "Result 2", "Result 3"]
6
- return "\n".join(results)
7
 
8
- demo = gr.Interface(fn=search, inputs=["text", "checkbox"], outputs="text")
9
 
10
- with gr.Blocks() as demo:
11
- with gr.Row():
12
- input_text = gr.Textbox("text", label="Enter your search query:")
13
- default_options = gr.Radio("text", label="Default Options", choices=["Option 1", "Option 2", "Option 3"])
14
 
15
- with gr.Row():
16
- with gr.Column():
17
- strategy_1 = gr.Checkbox("text", label="Strategy 1", choices=["ChatGPT", "LLaMA", "Vicuna", "Alpaca", "Flan-T"])
18
- with gr.Column():
19
- strategy_2 = gr.Checkbox("text", label="Strategy 2", choices=["ChatGPT", "LLaMA", "Vicuna", "Alpaca", "Flan-T5"])
20
- with gr.Column():
21
- strategy_3 = gr.Checkbox("text", label="Strategy 3", choices=["ChatGPT", "LLaMA", "Vicuna", "Alpaca", "Flan-T5"])
22
 
23
- demo.launch()
 
1
  import gradio as gr
2
 
3
+ from transformers import pipeline
 
 
 
4
 
5
+ pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-en-es")
6
 
7
+ def predict(text):
8
+ return pipe(text)[0]["translation_text"]
 
 
9
 
10
+ demo = gr.Interface(
11
+ fn=predict,
12
+ inputs='text',
13
+ outputs='text',
14
+ )
 
 
15
 
16
+ demo.launch()