Spaces:
Paused
Paused
Commit ·
ccc3e1a
1
Parent(s): 0a9f00a
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,27 +8,21 @@ response = requests.get(url)
|
|
| 8 |
with open("./model.gguf", mode="wb") as file:
|
| 9 |
file.write(response.content)
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
embedding=False
|
| 16 |
-
)
|
| 17 |
-
)
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
content = f.read()
|
| 22 |
|
|
|
|
| 23 |
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
| 27 |
|
| 28 |
-
|
| 29 |
-
import uvicorn
|
| 30 |
-
uvicorn.run(app,
|
| 31 |
-
host="0.0.0.0",
|
| 32 |
-
port=int("2600")
|
| 33 |
-
)
|
| 34 |
|
|
|
|
| 8 |
with open("./model.gguf", mode="wb") as file:
|
| 9 |
file.write(response.content)
|
| 10 |
|
| 11 |
+
llm = Llama(model_path="./model.gguf")
|
| 12 |
+
def generate_text(input_text):
|
| 13 |
+
output = llm(f"Q: {input_text} A:", max_tokens=256, stop=["Q:", "\n"], echo=True)
|
| 14 |
+
return output['choices'][0]['text']
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
+
input_text = gr.inputs.Textbox(lines= 10, label="Enter your input text")
|
| 17 |
+
output_text = gr.outputs.Textbox(label="Output text")
|
|
|
|
| 18 |
|
| 19 |
+
description = "llama.cpp implementation in python [https://github.com/abetlen/llama-cpp-python]"
|
| 20 |
|
| 21 |
+
examples = [
|
| 22 |
+
["What is the capital of France? ", "The capital of France is Paris."],
|
| 23 |
+
["Who wrote the novel 'Pride and Prejudice'?", "The novel 'Pride and Prejudice' was written by Jane Austen."],
|
| 24 |
+
["What is the square root of 64?", "The square root of 64 is 8."]
|
| 25 |
+
]
|
| 26 |
|
| 27 |
+
gr.Interface(fn=generate_text, inputs=input_text, outputs=output_text, title="Llama Language Model", description=description, examples=examples).launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|