Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -17,7 +17,7 @@ model_name = "unsloth.Q4_K_M.gguf"
|
|
17 |
model_path = os.path.join(model_dir, model_name)
|
18 |
|
19 |
hf_hub_download(
|
20 |
-
repo_id="vislupus/bulgarian-joke-master-
|
21 |
filename=model_name,
|
22 |
local_dir=model_dir
|
23 |
)
|
@@ -36,32 +36,11 @@ def generate_response(prompt, temperature=0.7, top_p=1.0, max_tokens=256):
|
|
36 |
except Exception as e:
|
37 |
return f"Error generating response: {e}"
|
38 |
|
39 |
-
|
40 |
-
gr.
|
41 |
-
gr.Markdown(description)
|
42 |
-
|
43 |
-
prompt_input = gr.Textbox(label="Your Prompt", placeholder="Type your message here...", lines=5)
|
44 |
-
|
45 |
-
with gr.Accordion("Advanced Settings", open=False):
|
46 |
-
temperature = gr.Slider(0.1, 2.0, value=0.7, step=0.1, label="Temperature")
|
47 |
-
top_p = gr.Slider(0.1, 1.0, value=1.0, step=0.01, label="Top-p")
|
48 |
-
max_tokens = gr.Slider(16, 512, value=256, step=16, label="Max Tokens")
|
49 |
-
|
50 |
-
response_output = gr.Textbox(label="Model Response", placeholder="The model's response will appear here...", lines=10)
|
51 |
-
|
52 |
-
generate_button = gr.Button("Generate Response")
|
53 |
-
|
54 |
-
generate_button.click(
|
55 |
generate_response,
|
56 |
-
|
57 |
-
|
58 |
)
|
59 |
|
60 |
-
|
61 |
-
demo.launch(share=True)
|
62 |
-
|
63 |
-
try:
|
64 |
-
if llm:
|
65 |
-
llm.close()
|
66 |
-
except Exception as e:
|
67 |
-
print(f"Error closing model: {e}")
|
|
|
17 |
model_path = os.path.join(model_dir, model_name)
|
18 |
|
19 |
hf_hub_download(
|
20 |
+
repo_id="vislupus/bulgarian-joke-master-SmolLM2-135M-Instruct-bnb-4bit-gguf",
|
21 |
filename=model_name,
|
22 |
local_dir=model_dir
|
23 |
)
|
|
|
36 |
except Exception as e:
|
37 |
return f"Error generating response: {e}"
|
38 |
|
39 |
+
if __name__ == "__main__":
|
40 |
+
rag = gr.ChatInterface(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
generate_response,
|
42 |
+
title=title,
|
43 |
+
description=description,
|
44 |
)
|
45 |
|
46 |
+
rag.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|