asd
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@ import json
|
|
2 |
import torch
|
3 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
4 |
from peft import PeftModel, PeftConfig
|
5 |
-
from huggingface_hub import HfApi
|
6 |
import gradio as gr
|
7 |
|
8 |
# Global variables to store the model and tokenizer
|
@@ -74,21 +74,20 @@ def run_merge_and_push():
|
|
74 |
|
75 |
# Gradio interface
|
76 |
with gr.Blocks() as demo:
|
77 |
-
with gr.
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
merge_and_push_button.click(run_merge_and_push, outputs=merge_and_push_output)
|
92 |
|
93 |
# Launch the interface
|
94 |
if __name__ == "__main__":
|
|
|
2 |
import torch
|
3 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
4 |
from peft import PeftModel, PeftConfig
|
5 |
+
from huggingface_hub import HfApi
|
6 |
import gradio as gr
|
7 |
|
8 |
# Global variables to store the model and tokenizer
|
|
|
74 |
|
75 |
# Gradio interface
|
76 |
with gr.Blocks() as demo:
|
77 |
+
with gr.Tab("Generate Text"):
|
78 |
+
iface = gr.Interface(
|
79 |
+
fn=generate_text,
|
80 |
+
inputs=gr.Textbox(lines=5, label="Input Text"),
|
81 |
+
outputs=gr.Textbox(lines=10, label="Generated Text"),
|
82 |
+
title="Merged Llama 3 8B Instruct Model",
|
83 |
+
description="Enter text to generate a response from the merged model.",
|
84 |
+
)
|
85 |
+
iface.launch()
|
86 |
+
|
87 |
+
with gr.Tab("Merge and Push"):
|
88 |
+
merge_and_push_button = gr.Button("Merge Models and Push to Hub")
|
89 |
+
merge_and_push_output = gr.Textbox(lines=20, label="Merge and Push Output")
|
90 |
+
merge_and_push_button.click(run_merge_and_push, outputs=merge_and_push_output)
|
|
|
91 |
|
92 |
# Launch the interface
|
93 |
if __name__ == "__main__":
|