Emil25 commited on
Commit
b7b8567
1 Parent(s): b5d0459

Delete pages/Visualization.py

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