Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,11 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
def
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
demo = gr.Interface(
|
| 7 |
-
fn=
|
| 8 |
-
inputs=[
|
| 9 |
outputs=["text"],
|
| 10 |
)
|
| 11 |
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
import os
|
| 3 |
+
import random
|
| 4 |
import gradio as gr
|
| 5 |
+
from transformers import pipeline
|
| 6 |
+
import base64
|
| 7 |
+
from datasets import load_dataset
|
| 8 |
+
from diffusers import DiffusionPipeline
|
| 9 |
+
from huggingface_hub import login
|
| 10 |
+
import numpy as np
|
| 11 |
|
| 12 |
+
def guessanImage(image):
|
| 13 |
+
model = "microsoft/resnet-50"
|
| 14 |
+
st.write("using model:"+model)
|
| 15 |
+
imgclassifier = pipeline("image-classification", model=model)
|
| 16 |
+
if image is not None:
|
| 17 |
+
imgclassifier(image)
|
| 18 |
+
|
| 19 |
+
return description
|
| 20 |
|
| 21 |
demo = gr.Interface(
|
| 22 |
+
fn=guessanImage,
|
| 23 |
+
inputs=[gr.Image()],
|
| 24 |
outputs=["text"],
|
| 25 |
)
|
| 26 |
|