Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,20 +2,14 @@ import gradio as gr
|
|
| 2 |
from ctransformers import AutoModelForCausalLM
|
| 3 |
import time
|
| 4 |
|
| 5 |
-
# Note: If this is a private or gated repo, you need to authenticate with your HF token.
|
| 6 |
-
# You can do this by setting the environment variable HF_HOME or passing token to from_pretrained.
|
| 7 |
-
# For public repos, no extra auth needed.
|
| 8 |
-
|
| 9 |
llm = AutoModelForCausalLM.from_pretrained(
|
| 10 |
-
"TheBloke/WizardCoder-Python-7B-V1.0-GGUF",
|
| 11 |
-
model_file="wizardcoder-python-7b-v1.0.Q4_K_M.gguf",
|
| 12 |
model_type="llama",
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
"stream": True
|
| 18 |
-
}
|
| 19 |
)
|
| 20 |
|
| 21 |
def generate_response(message, history):
|
|
@@ -32,7 +26,6 @@ def generate_response(message, history):
|
|
| 32 |
time.sleep(0.01)
|
| 33 |
yield history
|
| 34 |
|
| 35 |
-
# Gradio UI
|
| 36 |
with gr.Blocks() as demo:
|
| 37 |
chatbot = gr.Chatbot()
|
| 38 |
msg = gr.Textbox(placeholder="Ask coding questions...", label="Your Message")
|
|
|
|
| 2 |
from ctransformers import AutoModelForCausalLM
|
| 3 |
import time
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
llm = AutoModelForCausalLM.from_pretrained(
|
| 6 |
+
"TheBloke/WizardCoder-Python-7B-V1.0-GGUF",
|
| 7 |
+
model_file="wizardcoder-python-7b-v1.0.Q4_K_M.gguf",
|
| 8 |
model_type="llama",
|
| 9 |
+
max_new_tokens=512,
|
| 10 |
+
temperature=0.7,
|
| 11 |
+
top_p=0.9,
|
| 12 |
+
stream=True
|
|
|
|
|
|
|
| 13 |
)
|
| 14 |
|
| 15 |
def generate_response(message, history):
|
|
|
|
| 26 |
time.sleep(0.01)
|
| 27 |
yield history
|
| 28 |
|
|
|
|
| 29 |
with gr.Blocks() as demo:
|
| 30 |
chatbot = gr.Chatbot()
|
| 31 |
msg = gr.Textbox(placeholder="Ask coding questions...", label="Your Message")
|