Spaces:
Sleeping
Sleeping
remove print
Browse files- .gitignore +1 -0
- app.py +7 -2
- requirements.txt +2 -1
.gitignore
CHANGED
@@ -1 +1,2 @@
|
|
1 |
venv
|
|
|
|
1 |
venv
|
2 |
+
.env
|
app.py
CHANGED
@@ -5,7 +5,7 @@ import pytesseract
|
|
5 |
|
6 |
import os
|
7 |
|
8 |
-
api_key = os.
|
9 |
|
10 |
# API URL and headers
|
11 |
API_URL = "https://pllfc7e5i0rujahy.us-east-1.aws.endpoints.huggingface.cloud"
|
@@ -30,7 +30,11 @@ def extract_text_from_image(image_path):
|
|
30 |
st.title("API Query App")
|
31 |
st.write("This app allows you to query the API and retrieve responses.")
|
32 |
|
33 |
-
user_input =
|
|
|
|
|
|
|
|
|
34 |
|
35 |
# File uploader for the image
|
36 |
uploaded_image = st.file_uploader("Upload an image", type=["png", "jpg", "jpeg"])
|
@@ -46,6 +50,7 @@ if st.button("Submit"):
|
|
46 |
|
47 |
with st.spinner("Fetching response from API..."):
|
48 |
# Query the API with user input
|
|
|
49 |
output = query({"inputs": user_input, "parameters": {}})
|
50 |
st.success("Response received!")
|
51 |
st.write(output[0]["generated_text"]) # Display the response
|
|
|
5 |
|
6 |
import os
|
7 |
|
8 |
+
api_key = os.environ.get("HFBearer")
|
9 |
|
10 |
# API URL and headers
|
11 |
API_URL = "https://pllfc7e5i0rujahy.us-east-1.aws.endpoints.huggingface.cloud"
|
|
|
30 |
st.title("API Query App")
|
31 |
st.write("This app allows you to query the API and retrieve responses.")
|
32 |
|
33 |
+
user_input = """
|
34 |
+
You will be given a text containing some parameters I want you to extract in json format.
|
35 |
+
Here are all the paramters:
|
36 |
+
|
37 |
+
"""
|
38 |
|
39 |
# File uploader for the image
|
40 |
uploaded_image = st.file_uploader("Upload an image", type=["png", "jpg", "jpeg"])
|
|
|
50 |
|
51 |
with st.spinner("Fetching response from API..."):
|
52 |
# Query the API with user input
|
53 |
+
input = user_input + " :"
|
54 |
output = query({"inputs": user_input, "parameters": {}})
|
55 |
st.success("Response received!")
|
56 |
st.write(output[0]["generated_text"]) # Display the response
|
requirements.txt
CHANGED
@@ -1,2 +1,3 @@
|
|
1 |
requests
|
2 |
-
pytesseract
|
|
|
|
1 |
requests
|
2 |
+
pytesseract
|
3 |
+
streamlit
|