Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,39 @@ from huggingface_hub import create_repo
|
|
| 7 |
#from gradio import forms
|
| 8 |
import time
|
| 9 |
|
|
|
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
def generate_files(title="Text Generation Tool", tool_description="This is a tool that chats with a user. "
|
| 13 |
"It takes an input named `prompt` which contains a system_role, user_message, context and history. It returns a text message."):
|
|
|
|
| 7 |
#from gradio import forms
|
| 8 |
import time
|
| 9 |
|
| 10 |
+
###############################
|
| 11 |
|
| 12 |
+
import streamlit as st
|
| 13 |
+
import pyautogui
|
| 14 |
+
|
| 15 |
+
st.title("Chat Interface with Screenshot Capability")
|
| 16 |
+
|
| 17 |
+
# Create a chat input field
|
| 18 |
+
chat_input = st.chat_input(
|
| 19 |
+
placeholder="Type your message or click the button to take a screenshot...",
|
| 20 |
+
key="chat_input"
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
+
# Create a button to trigger the screenshot capture
|
| 24 |
+
screenshot_button = st.button("Take Screenshot")
|
| 25 |
+
|
| 26 |
+
# Define a function to capture the screenshot
|
| 27 |
+
def capture_screenshot():
|
| 28 |
+
# Capture the entire screen
|
| 29 |
+
img = pyautogui.screenshot("EntireScreen")
|
| 30 |
+
|
| 31 |
+
# Upload the screenshot to the chat input field
|
| 32 |
+
chat_input.insert_image(img)
|
| 33 |
+
|
| 34 |
+
# Bind the function to the button
|
| 35 |
+
screenshot_button.do(capture_screenshot)
|
| 36 |
+
|
| 37 |
+
# Display the chat input field and button
|
| 38 |
+
st.write(chat_input)
|
| 39 |
+
st.write(screenshot_button)
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
####################
|
| 43 |
|
| 44 |
def generate_files(title="Text Generation Tool", tool_description="This is a tool that chats with a user. "
|
| 45 |
"It takes an input named `prompt` which contains a system_role, user_message, context and history. It returns a text message."):
|