suryabbrj commited on
Commit
3200d15
0 Parent(s):

Duplicate from suryabbrj/CollegeProjectV2

Browse files
Files changed (4) hide show
  1. .gitattributes +34 -0
  2. README.md +13 -0
  3. app.py +52 -0
  4. requirements.txt +3 -0
.gitattributes ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tflite filter=lfs diff=lfs merge=lfs -text
29
+ *.tgz filter=lfs diff=lfs merge=lfs -text
30
+ *.wasm filter=lfs diff=lfs merge=lfs -text
31
+ *.xz filter=lfs diff=lfs merge=lfs -text
32
+ *.zip filter=lfs diff=lfs merge=lfs -text
33
+ *.zst filter=lfs diff=lfs merge=lfs -text
34
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: CollegeProjectV2
3
+ emoji: 📚
4
+ colorFrom: yellow
5
+ colorTo: red
6
+ sdk: gradio
7
+ sdk_version: 3.27.0
8
+ app_file: app.py
9
+ pinned: false
10
+ duplicated_from: suryabbrj/CollegeProjectV2
11
+ ---
12
+
13
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+ # install gradio library for the ui
4
+ #!pip install -q gradio
5
+
6
+ # install transformers to include pipeline to import and run pretrained image-to-text model.
7
+ #!pip install transformers
8
+
9
+ # ignore model warnings from logging to the console.
10
+ import warnings
11
+ import logging
12
+ warnings.simplefilter('ignore')
13
+ logging.disable(logging.WARNING)
14
+
15
+ # import pipeline function from transformers.
16
+
17
+ # import gradio to begin wrapping ui to the function model.
18
+
19
+ # import pretrained model and its weights to the predict funtion [this is an optional step that may help speed up prediction by caching the weights to the ml platform. this only logs the prediction to the console, and thus the prediction is not entirely useful in application.]
20
+ cap = pipeline('image-to-text')
21
+
22
+ # uncomment and pass any url/path to the var img and invoke function to predict the caption.
23
+
24
+ # url = 'https://cdn.pixabay.com/photo/2023/02/25/12/30/man-7813108_960_720.jpg'
25
+ # cap(url)
26
+
27
+ # add sentiment analysis to the caption to identify possible suicidal and depression symptoms!!
28
+
29
+
30
+ def predict(image):
31
+ cap = pipeline('image-to-text')
32
+ caption = cap(image)
33
+ output = str(caption)
34
+ return output[21:-4]
35
+
36
+
37
+ input = gr.inputs.Image(
38
+ label="Upload your Image and wait for 8-12 seconds!", type='pil', optional=False)
39
+ output = gr.outputs.Textbox(label="Captions")
40
+
41
+ title = "Content ModX UI "
42
+
43
+ interface = gr.Interface(
44
+ fn=predict,
45
+ inputs=input,
46
+ theme="grass",
47
+ outputs=output,
48
+ title=title,
49
+ flagging_options=["correct", "just okay", "wrong"],
50
+
51
+ )
52
+ interface.launch()
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ transformers
2
+ gradio==3.20.1
3
+ tensorflow==2.11.*