Spaces:
Running
Running
app17
Browse files
app.py
CHANGED
@@ -31,7 +31,7 @@ from pydantic import BaseModel
|
|
31 |
import shutil
|
32 |
|
33 |
# Cell 1: Image Classification Model
|
34 |
-
image_pipeline = pipeline(task="image-classification", model="
|
35 |
|
36 |
def predict_image(input_img):
|
37 |
predictions = image_pipeline(input_img)
|
@@ -39,9 +39,9 @@ def predict_image(input_img):
|
|
39 |
|
40 |
image_gradio_app = gr.Interface(
|
41 |
fn=predict_image,
|
42 |
-
inputs=gr.Image(label="Select
|
43 |
outputs=[gr.Image(label="Processed Image"), gr.Label(label="Result", num_top_classes=2)],
|
44 |
-
title="
|
45 |
)
|
46 |
|
47 |
# Cell 2: Chatbot Model
|
@@ -50,8 +50,8 @@ loader = PyPDFDirectoryLoader('pdfs')
|
|
50 |
data=loader.load()
|
51 |
# split documents
|
52 |
text_splitter = RecursiveCharacterTextSplitter(
|
53 |
-
chunk_size=
|
54 |
-
chunk_overlap=
|
55 |
length_function=len
|
56 |
)
|
57 |
docs = text_splitter.split_documents(data)
|
|
|
31 |
import shutil
|
32 |
|
33 |
# Cell 1: Image Classification Model
|
34 |
+
image_pipeline = pipeline(task="image-classification", model="rocioadlc/TrashNet_ResNet152V2")
|
35 |
|
36 |
def predict_image(input_img):
|
37 |
predictions = image_pipeline(input_img)
|
|
|
39 |
|
40 |
image_gradio_app = gr.Interface(
|
41 |
fn=predict_image,
|
42 |
+
inputs=gr.Image(label="Select waste candidate", sources=['upload', 'webcam'], type="pil"),
|
43 |
outputs=[gr.Image(label="Processed Image"), gr.Label(label="Result", num_top_classes=2)],
|
44 |
+
title="What kind of waste do you have?",
|
45 |
)
|
46 |
|
47 |
# Cell 2: Chatbot Model
|
|
|
50 |
data=loader.load()
|
51 |
# split documents
|
52 |
text_splitter = RecursiveCharacterTextSplitter(
|
53 |
+
chunk_size=500,
|
54 |
+
chunk_overlap=70,
|
55 |
length_function=len
|
56 |
)
|
57 |
docs = text_splitter.split_documents(data)
|