Spaces:
Runtime error
Runtime error
Added text for when LLM model is disabled
Browse files
app.py
CHANGED
@@ -96,13 +96,19 @@ with gr.Blocks(theme = gr.themes.Soft()) as demo:
|
|
96 |
return md_text_updated, prompt
|
97 |
|
98 |
def ask_llm(prompt, llm_model_picked = 'mistralai/Mistral-7B-Instruct-v0.2'):
|
|
|
|
|
99 |
if llm_model_picked == 'None':
|
100 |
-
|
|
|
|
|
|
|
|
|
101 |
client = InferenceClient(llm_model_picked)
|
102 |
#output = client.text_generation(prompt, **generate_kwargs, stream=False, details=False, return_full_text=False)
|
103 |
stream = client.text_generation(prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
104 |
#output = output.lstrip(' \n') if output.lstrip().startswith('\n') else output
|
105 |
-
|
106 |
|
107 |
for response in stream:
|
108 |
output += response.token.text
|
|
|
96 |
return md_text_updated, prompt
|
97 |
|
98 |
def ask_llm(prompt, llm_model_picked = 'mistralai/Mistral-7B-Instruct-v0.2'):
|
99 |
+
model_disabled_text = "LLM Model is disabled"
|
100 |
+
output = ""
|
101 |
if llm_model_picked == 'None':
|
102 |
+
for out in model_disabled_text:
|
103 |
+
output += out
|
104 |
+
yield output
|
105 |
+
return output
|
106 |
+
|
107 |
client = InferenceClient(llm_model_picked)
|
108 |
#output = client.text_generation(prompt, **generate_kwargs, stream=False, details=False, return_full_text=False)
|
109 |
stream = client.text_generation(prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
110 |
#output = output.lstrip(' \n') if output.lstrip().startswith('\n') else output
|
111 |
+
|
112 |
|
113 |
for response in stream:
|
114 |
output += response.token.text
|