Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,7 +12,7 @@ def generate_text(input_text):
|
|
| 12 |
output = llm(f"Q: {input_text} A:", max_tokens=521, stop=["Q:", "\n"], echo=True)
|
| 13 |
return output['choices'][0]['text']
|
| 14 |
|
| 15 |
-
input_text =
|
| 16 |
output_text = gr.outputs.Textbox(label="Output text")
|
| 17 |
|
| 18 |
description = "bro neil it currently dosent work two people sending it request at the same time so going to fix that but currently running ggml models with llama.cpp implementation in python [https://github.com/abetlen/llama-cpp-python]"
|
|
@@ -23,28 +23,7 @@ examples = [
|
|
| 23 |
["What is the square root of 64?", "The square root of 64 is 8."]
|
| 24 |
]
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
clear = gr.Button("Clear")
|
| 30 |
-
|
| 31 |
-
def user(user_message, history):
|
| 32 |
-
return "", history + [[user_message, None]]
|
| 33 |
-
|
| 34 |
-
def bot(history):
|
| 35 |
-
bot_message = gr.outputs.Textbox(label="Output text")
|
| 36 |
-
history[-1][1] = ""
|
| 37 |
-
for character in bot_message:
|
| 38 |
-
history[-1][1] += character
|
| 39 |
-
time.sleep(0.05)
|
| 40 |
-
yield history
|
| 41 |
-
|
| 42 |
-
msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False).then(
|
| 43 |
-
bot, chatbot, chatbot
|
| 44 |
-
)
|
| 45 |
-
clear.click(lambda: None, None, chatbot, queue=False)
|
| 46 |
-
|
| 47 |
-
demo.queue()
|
| 48 |
-
if __name__ == "__main__":
|
| 49 |
-
demo.launch()
|
| 50 |
|
|
|
|
| 12 |
output = llm(f"Q: {input_text} A:", max_tokens=521, stop=["Q:", "\n"], echo=True)
|
| 13 |
return output['choices'][0]['text']
|
| 14 |
|
| 15 |
+
input_text = gr.inputs.Textbox(lines= 10, label="Enter your input text")
|
| 16 |
output_text = gr.outputs.Textbox(label="Output text")
|
| 17 |
|
| 18 |
description = "bro neil it currently dosent work two people sending it request at the same time so going to fix that but currently running ggml models with llama.cpp implementation in python [https://github.com/abetlen/llama-cpp-python]"
|
|
|
|
| 23 |
["What is the square root of 64?", "The square root of 64 is 8."]
|
| 24 |
]
|
| 25 |
|
| 26 |
+
demo = gr.Interface(fn=generate_text, inputs=input_text, outputs=output_text, title="Llama Language Model", description=description, examples=examples)
|
| 27 |
+
demo.queue(concurrency_count=3)
|
| 28 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|