Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -6,11 +6,11 @@ import gradio as gr
|
|
| 6 |
def GetLlamaResponse(topic):
|
| 7 |
llm = CTransformers(
|
| 8 |
model_type="llama",
|
| 9 |
-
model="
|
| 10 |
config={"max_new_tokens": 256, "temperature": 0.4},
|
| 11 |
)
|
| 12 |
template = """
|
| 13 |
-
|
| 14 |
"""
|
| 15 |
prompt = PromptTemplate(
|
| 16 |
input_variables=["topic", "word_count", "poem_style", "temperature"],
|
|
@@ -65,18 +65,18 @@ def GetLlamaResponse(topic):
|
|
| 65 |
|
| 66 |
|
| 67 |
inputs_image_url = [
|
| 68 |
-
gr.Textbox(type="text", label="
|
| 69 |
]
|
| 70 |
|
| 71 |
outputs_result_dict = [
|
| 72 |
-
gr.Textbox(type="text", label="Result
|
| 73 |
]
|
| 74 |
|
| 75 |
interface_image_url = gr.Interface(
|
| 76 |
fn=GetLlamaResponse,
|
| 77 |
inputs=inputs_image_url,
|
| 78 |
outputs=outputs_result_dict,
|
| 79 |
-
title="
|
| 80 |
cache_examples=False,
|
| 81 |
)
|
| 82 |
|
|
|
|
| 6 |
def GetLlamaResponse(topic):
|
| 7 |
llm = CTransformers(
|
| 8 |
model_type="llama",
|
| 9 |
+
model="llama-2-7b-chat.ggmlv3.q8_0.bin",
|
| 10 |
config={"max_new_tokens": 256, "temperature": 0.4},
|
| 11 |
)
|
| 12 |
template = """
|
| 13 |
+
Generate a poem for hungry natural who wish to eat a delicious {topic} within 256 words
|
| 14 |
"""
|
| 15 |
prompt = PromptTemplate(
|
| 16 |
input_variables=["topic", "word_count", "poem_style", "temperature"],
|
|
|
|
| 65 |
|
| 66 |
|
| 67 |
inputs_image_url = [
|
| 68 |
+
gr.Textbox(type="text", label="Topic Name"),
|
| 69 |
]
|
| 70 |
|
| 71 |
outputs_result_dict = [
|
| 72 |
+
gr.Textbox(type="text", label="Result"),
|
| 73 |
]
|
| 74 |
|
| 75 |
interface_image_url = gr.Interface(
|
| 76 |
fn=GetLlamaResponse,
|
| 77 |
inputs=inputs_image_url,
|
| 78 |
outputs=outputs_result_dict,
|
| 79 |
+
title="Poem Generation",
|
| 80 |
cache_examples=False,
|
| 81 |
)
|
| 82 |
|