Update app.py
Browse files
app.py
CHANGED
@@ -7,6 +7,7 @@ import time
|
|
7 |
import random
|
8 |
# streamlit
|
9 |
import streamlit as st
|
|
|
10 |
# components from other authors
|
11 |
from streamlit_mic_recorder import mic_recorder
|
12 |
# core modules
|
@@ -18,6 +19,8 @@ from vlm.vlm import VLM
|
|
18 |
from utils.keywords import keywords
|
19 |
from utils.prompt_toggle import select_prompt, load_prompts
|
20 |
from utils.image_caption import ImageCaption
|
|
|
|
|
21 |
|
22 |
prompts = load_prompts()
|
23 |
chat = Conversation()
|
@@ -36,10 +39,9 @@ def exctrator(sentence, phrase="show me your image"):
|
|
36 |
return extracted_text
|
37 |
|
38 |
def switching(text):
|
39 |
-
command = re.search("show me your image", text.lower(), re.IGNORECASE) if text is not None else "Error because your voice request is None"
|
40 |
result = None
|
41 |
|
42 |
-
if
|
43 |
prompt = exctrator(text.lower())
|
44 |
# Завантажуємо зображення
|
45 |
uploaded_image = ic.load_image()
|
@@ -50,6 +52,10 @@ def switching(text):
|
|
50 |
else:
|
51 |
# Якщо зображення ще не завантажене, показуємо попередження
|
52 |
st.warning("No image uploaded yet. Please upload an image to continue.")
|
|
|
|
|
|
|
|
|
53 |
else:
|
54 |
prompt = select_prompt(input_text=text, prompts=prompts, keywords=keywords)
|
55 |
result = chat.chatting(prompt=prompt if prompt is not None else text)
|
|
|
7 |
import random
|
8 |
# streamlit
|
9 |
import streamlit as st
|
10 |
+
import streamlit.components.v1 as components
|
11 |
# components from other authors
|
12 |
from streamlit_mic_recorder import mic_recorder
|
13 |
# core modules
|
|
|
19 |
from utils.keywords import keywords
|
20 |
from utils.prompt_toggle import select_prompt, load_prompts
|
21 |
from utils.image_caption import ImageCaption
|
22 |
+
from utils.documentation import html_content
|
23 |
+
from utils.payment import html_doge_wallet
|
24 |
|
25 |
prompts = load_prompts()
|
26 |
chat = Conversation()
|
|
|
39 |
return extracted_text
|
40 |
|
41 |
def switching(text):
|
|
|
42 |
result = None
|
43 |
|
44 |
+
if re.search("show me your image", text.lower(), re.IGNORECASE):
|
45 |
prompt = exctrator(text.lower())
|
46 |
# Завантажуємо зображення
|
47 |
uploaded_image = ic.load_image()
|
|
|
52 |
else:
|
53 |
# Якщо зображення ще не завантажене, показуємо попередження
|
54 |
st.warning("No image uploaded yet. Please upload an image to continue.")
|
55 |
+
elif re.search("show me documentation", text.lower(), re.IGNORECASE):
|
56 |
+
components.html(html_content, height=800, scrolling=True)
|
57 |
+
elif re.search("pay the ghost", text.lowe(), re.IGNORECASE):
|
58 |
+
components.html(html_doge_wallet, height=600, scrolling=False)
|
59 |
else:
|
60 |
prompt = select_prompt(input_text=text, prompts=prompts, keywords=keywords)
|
61 |
result = chat.chatting(prompt=prompt if prompt is not None else text)
|