allimonae commited on
Commit
9fd68f0
·
verified ·
1 Parent(s): 38040d9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -17
app.py CHANGED
@@ -1,18 +1,15 @@
1
- import torch
2
- from diffusers import Lumina2Text2ImgPipeline
 
3
 
4
- pipe = Lumina2Text2ImgPipeline.from_pretrained("Alpha-VLLM/Lumina-Image-2.0", torch_dtype=torch.bfloat16)
5
- pipe.enable_model_cpu_offload() #save some VRAM by offloading the model to CPU. Remove this if you have enough GPU power
6
-
7
- prompt = "A serene photograph capturing the golden reflection of the sun on a vast expanse of water. The sun is positioned at the top center, casting a brilliant, shimmering trail of light across the rippling surface. The water is textured with gentle waves, creating a rhythmic pattern that leads the eye towards the horizon. The entire scene is bathed in warm, golden hues, enhancing the tranquil and meditative atmosphere. High contrast, natural lighting, golden hour, photorealistic, expansive composition, reflective surface, peaceful, visually harmonious."
8
- image = pipe(
9
- prompt,
10
- height=1024,
11
- width=1024,
12
- guidance_scale=4.0,
13
- num_inference_steps=50,
14
- cfg_trunc_ratio=0.25,
15
- cfg_normalization=True,
16
- generator=torch.Generator("cpu").manual_seed(0)
17
- ).images[0]
18
- image.save("lumina_demo.png")
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+ from PIL import Image
4
 
5
+ pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
6
+ st.title("Hot Dog? Or Not?")
7
+ file_name = st.file_uploader("Upload a hot dog candidate")
8
+ if file_name is not None:
9
+ col1, col2 = st.columns(2)
10
+ image = Image.open(file_name)
11
+ col1.image(image, use_column_width=True)
12
+ predictions = pipeline(image)
13
+ col2.header("Probabilities")
14
+ for p in predictions:
15
+ col2.subheader(f"{ p['label'] }: {round(p['score'] * 100, 1}%")