Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -53,6 +53,14 @@ def fn_text(
|
|
53 |
temperature,
|
54 |
top_p,
|
55 |
):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
messages = [{"role": "user", "content": output}]
|
57 |
#messages = [{"role": "system", "content": system_prompt}]
|
58 |
history.append(messages[0])
|
|
|
53 |
temperature,
|
54 |
top_p,
|
55 |
):
|
56 |
+
if input:
|
57 |
+
if os.path.splitext(input)[1].lower() in [".png", ".jpg", ".jpeg"]:
|
58 |
+
output = fn_image_to_text(input)
|
59 |
+
if os.path.splitext(input)[1].lower() == ".pdf":
|
60 |
+
output = fn_pdf_to_text(input)
|
61 |
+
else:
|
62 |
+
output = ""
|
63 |
+
|
64 |
messages = [{"role": "user", "content": output}]
|
65 |
#messages = [{"role": "system", "content": system_prompt}]
|
66 |
history.append(messages[0])
|