arifa2399 commited on
Commit
2beab59
Β·
verified Β·
1 Parent(s): aa10196

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -87
app.py DELETED
@@ -1,87 +0,0 @@
1
- import streamlit as st
2
- from PIL import Image
3
- import requests
4
-
5
- # Dummy functions to simulate the behavior of the removed pipelines
6
- def summarize(text):
7
- return "This is a summary of the text."
8
-
9
- def detect_age(image):
10
- return "Age: 25-30"
11
-
12
- def classify_image(image, candidate_labels):
13
- return [{"label": label, "score": 0.5} for label in candidate_labels]
14
-
15
- def detect_emotion(text):
16
- return "joy"
17
-
18
- def translate(text):
19
- return "Ceci est une traduction."
20
-
21
- st.title("NLP APP")
22
- option = st.sidebar.selectbox(
23
- "Choose a task",
24
- ("Summarization", "Age Detection", "Emotion Detection", "Image Classification", "Translation")
25
- )
26
-
27
- if option == "Summarization":
28
- st.title("Text Summarization")
29
- text = st.text_area("Enter text to summarize")
30
- if st.button("Summarize"):
31
- if text:
32
- st.write("Summary:", summarize(text))
33
- else:
34
- st.write("Please enter text to summarize.")
35
- elif option == "Age Detection":
36
- st.title("Welcome to age detection")
37
- uploaded_files = st.file_uploader("Choose an image file", type="jpg")
38
- if uploaded_files is not None:
39
- image = Image.open(uploaded_files)
40
- st.write(detect_age(image))
41
- elif option == "Image Classification":
42
- st.title("Welcome to object detection")
43
- uploaded_file = st.file_uploader("Choose an image file", type=["jpg", "jpeg", "png"])
44
- text = st.text_area("Enter possible class names (comma-separated)")
45
- if st.button("Submit"):
46
- if uploaded_file is not None and text:
47
- candidate_labels = [t.strip() for t in text.split(',')]
48
- image = Image.open(uploaded_file)
49
- st.image(image, caption="Uploaded Image", use_column_width=True)
50
- classification_result = classify_image(image, candidate_labels)
51
- for result in classification_result:
52
- st.write(f"Label: {result['label']}, Score: {result['score']}")
53
- else:
54
- st.write("Please upload an image file and enter class names.")
55
- elif option == "Emotion Detection":
56
- st.title("Detect your emotion")
57
- text = st.text_area("Enter your text")
58
- if st.button("Submit"):
59
- if text:
60
- emotion = detect_emotion(text)
61
- if emotion == "sadness":
62
- st.write("Emotion : ", emotion, "😒")
63
- elif emotion == "joy":
64
- st.write("Emotion : ", emotion, "πŸ˜ƒ")
65
- elif emotion == "fear":
66
- st.write("Emotion : ", emotion, "😨")
67
- elif emotion == "anger":
68
- st.write("Emotion : ", emotion, "😑")
69
- elif emotion == "neutral":
70
- st.write("Emotion : ", emotion, "😐")
71
- elif emotion == "disgust":
72
- st.write("Emotion : ", emotion, "🀒")
73
- elif emotion == "surprise":
74
- st.write("Emotion : ", emotion, "😲")
75
- else:
76
- st.write("Please enter text.")
77
- elif option == "Translation":
78
- st.title("Text Translation")
79
- text = st.text_area("Enter text to translate from English to French")
80
- if st.button("Translate"):
81
- if text:
82
- translation = translate(text)
83
- st.write("Translation:", translation)
84
- else:
85
- st.write("Please enter text to translate.")
86
- else:
87
- st.title("None")