Spaces:
Runtime error
Runtime error
aifeifei798
commited on
Commit
•
5801b74
1
Parent(s):
9c56dae
Update app.py
Browse files
app.py
CHANGED
@@ -25,7 +25,7 @@ llm = Llama(
|
|
25 |
)
|
26 |
|
27 |
|
28 |
-
def run_pic(image):
|
29 |
image = Image.open(image[0])
|
30 |
task_prompt = "<DESCRIPTION>"
|
31 |
prompt = task_prompt + "Describe this image in great detail."
|
@@ -56,16 +56,18 @@ def generate_text(
|
|
56 |
in_text = message['text']
|
57 |
in_files = message['files']
|
58 |
output=""
|
|
|
|
|
59 |
if in_files:
|
60 |
-
|
61 |
-
yield
|
62 |
else:
|
63 |
temp = ""
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
input_prompt
|
69 |
output = llm(
|
70 |
input_prompt,
|
71 |
temperature=temperature,
|
@@ -116,4 +118,4 @@ demo = gr.ChatInterface(
|
|
116 |
|
117 |
|
118 |
if __name__ == "__main__":
|
119 |
-
demo.launch(
|
|
|
25 |
)
|
26 |
|
27 |
|
28 |
+
# def run_pic(image):
|
29 |
image = Image.open(image[0])
|
30 |
task_prompt = "<DESCRIPTION>"
|
31 |
prompt = task_prompt + "Describe this image in great detail."
|
|
|
56 |
in_text = message['text']
|
57 |
in_files = message['files']
|
58 |
output=""
|
59 |
+
picoutput=""
|
60 |
+
history_prompt=""
|
61 |
if in_files:
|
62 |
+
picoutput=f"sends a picture that contains the following: {run_pic(in_files)}"
|
63 |
+
yield picoutput
|
64 |
else:
|
65 |
temp = ""
|
66 |
+
system_prompt = f'{system_message}'
|
67 |
+
for interaction in history:
|
68 |
+
history_prompt += str(interaction[0]) + str(interaction[1])
|
69 |
+
input_prompt = system_prompt + " " + history_prompt + " " + str(in_text)
|
70 |
+
print(input_prompt)
|
71 |
output = llm(
|
72 |
input_prompt,
|
73 |
temperature=temperature,
|
|
|
118 |
|
119 |
|
120 |
if __name__ == "__main__":
|
121 |
+
demo.launch()
|