Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,25 +1,30 @@
|
|
1 |
-
|
2 |
-
from
|
3 |
-
import
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
-
def
|
6 |
-
|
7 |
|
8 |
-
|
9 |
-
demo = gr.Blocks()
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
image_input = gr.Image(type="pil", label="Upload Image")
|
14 |
-
processed_image_output = gr.Image(label="Processed Image with Predicted Instances")
|
15 |
-
audio_output = gr.Audio(label="Generated Audio")
|
16 |
-
text_output = gr.Textbox(label="Extracted Text")
|
17 |
|
18 |
-
|
19 |
-
|
|
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
# Launch the Blocks app
|
25 |
-
demo.launch()
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from PIL import Image, ImageDraw
|
3 |
+
from helper import summarize_predictions_natural_language, render_results_in_image
|
4 |
+
from transformers import pipeline
|
5 |
+
from tokenizers import Tokenizer, Encoding
|
6 |
+
from tokenizers import decoders
|
7 |
+
from tokenizers import models
|
8 |
+
from tokenizers import normalizers
|
9 |
+
from tokenizers import pre_tokenizers
|
10 |
+
from tokenizers import processors
|
11 |
+
import io
|
12 |
+
import matplotlib.pyplot as plt
|
13 |
+
import requests
|
14 |
+
import inflect
|
15 |
+
from predictions import get_predictions # Replace 'your_module' with the name of the module where your function is defined
|
16 |
|
17 |
+
def main():
|
18 |
+
st.title("Object Detection App")
|
19 |
|
20 |
+
uploaded_image = st.file_uploader("Upload an image", type=["jpg", "jpeg", "png"])
|
|
|
21 |
|
22 |
+
if uploaded_image is not None:
|
23 |
+
processed_image, text, audio = get_predictions(uploaded_image)
|
|
|
|
|
|
|
|
|
24 |
|
25 |
+
st.image(processed_image, caption='Processed Image', use_column_width=True)
|
26 |
+
st.write(f"Predictions: {text}")
|
27 |
+
st.audio(audio, format='audio/wav')
|
28 |
|
29 |
+
if __name__ == '__main__':
|
30 |
+
main()
|
|
|
|
|
|