Emil25 commited on
Commit
208a680
·
1 Parent(s): 75b1bc5

Delete pages/Visualization.py

Browse files
Files changed (1) hide show
  1. pages/Visualization.py +0 -45
pages/Visualization.py DELETED
@@ -1,45 +0,0 @@
1
- import streamlit as st
2
- import requests
3
- import io
4
- from PIL import Image
5
- import os
6
-
7
- st.set_page_config(page_title="Student Assistant")
8
-
9
- # API для генерации изображения
10
- API_URL_img = "https://api-inference.huggingface.co/models/playgroundai/playground-v2-1024px-aesthetic"
11
- headers = {"Authorization": os.getenv("api_token")}
12
-
13
- # Функция генерации изображения
14
- def generate_img(payload):
15
- response = requests.post(API_URL_img, headers=headers, json=payload)
16
- return response.content
17
-
18
- st.markdown('# :female-student: Персональный помощник для студентов')
19
- st.divider()
20
- st.markdown("# :sparkles: Изучение английского языка через визуальное восприятие")
21
-
22
- image_idea = st.text_input('Предложите свою тему для генерации изображения', value="Astronaut riding a horse")
23
- image_gen__btn = st.button('Генерировать изображение')
24
- if image_gen__btn:
25
- with st.spinner('...'):
26
- try:
27
- image_bytes = generate_img({"inputs": image_idea})
28
- image_raw = io.BytesIO(image_bytes)
29
- st.success('Готово')
30
- st.image(image_raw)
31
- st.markdown('## Опишите фотографию на английском языке')
32
- st.markdown('## План ответа поможет вам:')
33
- st.markdown('+ the place;')
34
- st.markdown('+ the action;')
35
- st.markdown('+ the person’s appearance;')
36
- st.markdown('+ whether you like the picture or not;')
37
- st.markdown('+ why.')
38
- st.markdown('Start with: “I’d like to describe this picture. The picture shows …” ')
39
- except UnidentifiedImageError:
40
- st.warning('This is a warning', icon="⚠️")
41
-
42
-
43
- st.divider()
44
-
45
-