yxmauw commited on
Commit
19b3bf4
·
verified ·
1 Parent(s): eaaefff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -15
app.py CHANGED
@@ -21,22 +21,47 @@ def generate_text(input_text, selected_model):
21
  output = model.generate(input_text, max_tokens=100)
22
  return output
23
 
24
- model_dropdown = gr.Dropdown(choices=model_choices(),
25
- multiselect=False,
26
- label="LLMs to choose from",
27
- type="value",
28
- value="orca-mini-3b-gguf2-q4_0.gguf")
29
 
30
- explanation = gr.Textbox(label="Model Description", interactive=True, lines=10)
31
 
32
- model_dropdown.change(fn=llm_intro, inputs=model_dropdown, outputs=explanation)
33
 
34
- input_text = gr.Textbox(lines=5, label="Input Text")
35
- output_text = gr.Textbox(lines=5, label="Generated Text")
36
 
37
- gr.Interface(fn=generate_text,
38
- inputs=[input_text, model_dropdown],
39
- outputs=output_text,
40
- theme = gr.themes.Soft(),
41
- analytics_enabled=True,
42
- title="GPT4All Text Generation Experiment").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  output = model.generate(input_text, max_tokens=100)
22
  return output
23
 
24
+ # model_dropdown = gr.Dropdown(choices=model_choices(),
25
+ # multiselect=False,
26
+ # label="LLMs to choose from",
27
+ # type="value",
28
+ # value="orca-mini-3b-gguf2-q4_0.gguf")
29
 
30
+ # explanation = gr.Textbox(label="Model Description", interactive=True, lines=10)
31
 
32
+ # model_dropdown.change(fn=llm_intro, inputs=model_dropdown, outputs=explanation)
33
 
34
+ # input_text = gr.Textbox(lines=5, label="Input Text")
35
+ # output_text = gr.Textbox(lines=5, label="Generated Text")
36
 
37
+ # gr.Interface(fn=generate_text,
38
+ # inputs=[input_text, model_dropdown],
39
+ # outputs=output_text,
40
+ # theme = gr.themes.Soft(),
41
+ # analytics_enabled=True,
42
+ # title="GPT4All Text Generation Experiment").launch()
43
+
44
+ with gr.Blocks() as demo:
45
+ gr.Markdown("## GPT4All Text Generation Experiment")
46
+
47
+ # Dropdown to select model
48
+ model_selection = gr.Dropdown(label="Select an LLM", options=model_choices(), value=next(iter(model_description), None))
49
+
50
+ # Textbox to show model description
51
+ explanation = gr.Textbox(label="Model Description", value="Model description", lines=10, readonly=True)
52
+
53
+ # Link the dropdown with the textbox to update the description based on the selected model
54
+ model_selection.change(fn=llm_intro, inputs=model_selection, outputs=explanation)
55
+
56
+ # Input text for generating text
57
+ input_text = gr.Textbox(lines=10, label="Input Text")
58
+
59
+ # Textbox to display generated text
60
+ output_text = gr.Textbox(lines=10, label="Generated Text")
61
+
62
+ # Button to generate text
63
+ generate_btn = gr.Button("Generate")
64
+
65
+ generate_btn.click(fn=generate_text, inputs=[input_text, model_selection], outputs=output_text)
66
+
67
+ demo.launch()