Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio
|
2 |
+
from transformers import AutoImageProcessor, MobileNetV2Model
|
3 |
+
import torch
|
4 |
+
from datasets import load_dataset
|
5 |
+
|
6 |
+
image_processor = AutoImageProcessor.from_pretrained("Aruno/gemini-beauty")
|
7 |
+
model = MobileNetV2Model.from_pretrained("Aruno/gemini-beauty")
|
8 |
+
|
9 |
+
def inference(img):
|
10 |
+
inputs = image_processor(image, return_tensors="pt")
|
11 |
+
with torch.no_grad():
|
12 |
+
outputs = model(**inputs)
|
13 |
+
return outputs
|
14 |
+
|
15 |
+
iface = gradio.Interface(
|
16 |
+
fn=inference,
|
17 |
+
inputs='image',
|
18 |
+
outputs='image',
|
19 |
+
title='Hello World',
|
20 |
+
description='The simplest interface!',
|
21 |
+
examples=[])
|
22 |
+
|
23 |
+
iface.launch()
|