Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,13 +1,15 @@
|
|
1 |
import gradio as gr
|
2 |
from llama_cpp import Llama
|
3 |
|
4 |
-
llm = Llama(model_path="ggml-model-q4_0.bin")
|
5 |
|
6 |
def generate_text(input_text):
|
7 |
-
|
|
|
|
|
8 |
return output['choices'][0]['text']
|
9 |
|
10 |
-
input_text = gr.inputs.Textbox(
|
11 |
-
output_text = gr.outputs.Textbox(label="Output text")
|
12 |
|
13 |
gr.Interface(fn=generate_text, inputs=input_text, outputs=output_text, title="Alpaca GGML").launch()
|
|
|
1 |
import gradio as gr
|
2 |
from llama_cpp import Llama
|
3 |
|
4 |
+
llm = Llama(model_path="ggml-model-q4_0.bin", n_ctx=256, n_batch=128)
|
5 |
|
6 |
def generate_text(input_text):
|
7 |
+
print(input_text)
|
8 |
+
output = llm(f"### Instruction:\n{input_text}\n\n### Response:\n", max_tokens=128, echo=False)
|
9 |
+
print(output)
|
10 |
return output['choices'][0]['text']
|
11 |
|
12 |
+
input_text = gr.inputs.Textbox(label="Enter your input text")
|
13 |
+
output_text = gr.outputs.Textbox(lines= 10, label="Output text")
|
14 |
|
15 |
gr.Interface(fn=generate_text, inputs=input_text, outputs=output_text, title="Alpaca GGML").launch()
|