Spaces:
Sleeping
Sleeping
remove print
Browse files
app.py
CHANGED
@@ -31,8 +31,16 @@ 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
"""
|
38 |
|
@@ -45,12 +53,12 @@ if st.button("Submit"):
|
|
45 |
with st.spinner("Extracting text from image..."):
|
46 |
# Extract text from the uploaded image
|
47 |
extracted_text = extract_text_from_image(uploaded_image)
|
48 |
-
st.write("Extracted text from image
|
49 |
-
|
50 |
-
|
51 |
with st.spinner("Fetching response from API..."):
|
52 |
# Query the API with user input
|
53 |
-
|
54 |
-
output = query({"inputs":
|
55 |
st.success("Response received!")
|
56 |
-
st.write(output
|
|
|
|
31 |
st.write("This app allows you to query the API and retrieve responses.")
|
32 |
|
33 |
user_input = """
|
34 |
+
Extrais les paramètres suivants dans un json:
|
35 |
+
|
36 |
+
- Date de naissance
|
37 |
+
- Prénom
|
38 |
+
- Nom du patient
|
39 |
+
|
40 |
+
Dans ta réponse, le json (uniquement) doit apparaitre entre <JSON> et </JSON>.
|
41 |
+
Ne répond que par le json entre les balises, si les paramètres n'existent pas, laisse les champs vides.
|
42 |
+
|
43 |
+
Voici le texte qui contient les paramètres à extraire:
|
44 |
|
45 |
"""
|
46 |
|
|
|
53 |
with st.spinner("Extracting text from image..."):
|
54 |
# Extract text from the uploaded image
|
55 |
extracted_text = extract_text_from_image(uploaded_image)
|
56 |
+
st.write("Extracted text from image.")
|
57 |
+
|
|
|
58 |
with st.spinner("Fetching response from API..."):
|
59 |
# Query the API with user input
|
60 |
+
llm_input = user_input + extracted_text + "\n Donne uniquement le json entre balises, pas le texte:"
|
61 |
+
output = query({"inputs": llm_input, "parameters": {}})
|
62 |
st.success("Response received!")
|
63 |
+
st.write(output) # Display the response
|
64 |
+
|