NoaiGPT commited on
Commit
122c44e
1 Parent(s): 58a16f2
Files changed (1) hide show
  1. app.py +17 -16
app.py CHANGED
@@ -73,22 +73,23 @@ def run_merge_and_push():
73
  return "Model merged and pushed to Hugging Face Hub successfully!"
74
 
75
  # Gradio interface
76
- iface = gr.Interface(
77
- fn=generate_text,
78
- inputs=gr.Textbox(lines=5, label="Input Text"),
79
- outputs=gr.Textbox(lines=10, label="Generated Text"),
80
- title="Merged Llama 3 8B Instruct Model",
81
- description="Enter text to generate a response from the merged model.",
82
- )
83
-
84
- merge_and_push_button = gr.Button("Merge Models and Push to Hub")
85
- merge_and_push_output = gr.Textbox(lines=20, label="Merge and Push Output")
86
-
87
- merge_and_push_button.click(run_merge_and_push, outputs=merge_and_push_output)
 
 
 
 
88
 
89
  # Launch the interface
90
  if __name__ == "__main__":
91
- gr.TabbedInterface(
92
- [iface, gr.Interface(fn=lambda: "", inputs=None, outputs=merge_and_push_output)],
93
- ["Generate Text", "Merge and Push"]
94
- ).launch()
 
73
  return "Model merged and pushed to Hugging Face Hub successfully!"
74
 
75
  # Gradio interface
76
+ with gr.Blocks() as demo:
77
+ with gr.TabbedInterface(["Generate Text", "Merge and Push"]) as tabs:
78
+ with tabs[0]:
79
+ iface = gr.Interface(
80
+ fn=generate_text,
81
+ inputs=gr.Textbox(lines=5, label="Input Text"),
82
+ outputs=gr.Textbox(lines=10, label="Generated Text"),
83
+ title="Merged Llama 3 8B Instruct Model",
84
+ description="Enter text to generate a response from the merged model.",
85
+ )
86
+ iface.launch()
87
+
88
+ with tabs[1]:
89
+ merge_and_push_button = gr.Button("Merge Models and Push to Hub")
90
+ merge_and_push_output = gr.Textbox(lines=20, label="Merge and Push Output")
91
+ merge_and_push_button.click(run_merge_and_push, outputs=merge_and_push_output)
92
 
93
  # Launch the interface
94
  if __name__ == "__main__":
95
+ demo.launch()