pyresearch commited on
Commit
84abd57
·
1 Parent(s): c788f86

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +42 -23
app.py CHANGED
@@ -6,6 +6,47 @@ from clarifai_grpc.grpc.api.status import status_code_pb2
6
  # Set up the Streamlit app
7
  st.title("OpenAI Models Integration")
8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  # Model selection
10
  model_option = st.selectbox("Select Model", ["GPT-4 Turbo", "GPT-4 Vision", "DALL-E API", "Text-to-Speech (TTS)"])
11
 
@@ -62,26 +103,4 @@ elif model_option == "GPT-4 Vision":
62
  output_image = make_api_request(model_id, model_version_id, raw_text)
63
  st.image(output_image, caption='Generated Image', use_column_width=True)
64
 
65
- # DALL-E API
66
- elif model_option == "DALL-E API":
67
- PAT_dalle = 'bfdeb4029ef54d23a2e608b0aa4c00e4'
68
- USER_ID_dalle = 'openai'
69
- APP_ID_dalle = 'dall-e'
70
- MODEL_ID_dalle = 'dall-e-3'
71
- MODEL_VERSION_ID_dalle = 'dc9dcb6ee67543cebc0b9a025861b868'
72
- raw_text_dalle = st.text_area("Enter text prompt for DALL-E:", 'A penguin watching the sunset.')
73
- if st.button("Generate Image (DALL-E API)"):
74
- output_image_dalle = make_api_request(MODEL_ID_dalle, MODEL_VERSION_ID_dalle, raw_text_dalle)
75
- st.image(output_image_dalle, caption='Generated Image (DALL-E API)', use_column_width=True)
76
-
77
- # Text-to-Speech (TTS)
78
- elif model_option == "Text-to-Speech (TTS)":
79
- PAT_tts = 'bfdeb4029ef54d23a2e608b0aa4c00e4'
80
- USER_ID_tts = 'openai'
81
- APP_ID_tts = 'tts'
82
- MODEL_ID_tts = 'openai-tts-1'
83
- MODEL_VERSION_ID_tts = 'fff6ce1fd487457da95b79241ac6f02d'
84
- raw_text_tts = st.text_area("Enter text for Text-to-Speech:", 'I love your product very much')
85
- if st.button("Generate Speech"):
86
- output_audio = make_api_request(MODEL_ID_tts, MODEL_VERSION_ID_tts, raw_text_tts)
87
- st.audio(output_audio, format="audio/wav")
 
6
  # Set up the Streamlit app
7
  st.title("OpenAI Models Integration")
8
 
9
+ # Display HTML content
10
+ html_content = """
11
+ <div align="center">
12
+ <p>
13
+ <a href="https://www.youtube.com/channel/UCyB_7yHs7y8u9rONDSXgkCg?view_as=subscriber" target="_blank">
14
+ <img width="100%" src="https://github.com/pyresearch/pyresearch/blob/main/ai.png"></a>
15
+ </p>
16
+
17
+ [English](README.md) | [简体中文](README.md)
18
+ </div>
19
+
20
+ ## Installation
21
+ You can simply use pip to install the latest version of pyresearch.
22
+
23
+ <div align="center">`pip install pyresearch`</div>
24
+
25
+ <div align="center">
26
+ <a href="https://github.com/pyresearch/pyresearch" style="text-decoration:none;">
27
+ <img src="https://user-images.githubusercontent.com/34125851/226594737-c21e2dda-9cc6-42ef-b4e7-a685fea4a21d.png" width="2%" alt="" /></a>
28
+ <img src="https://user-images.githubusercontent.com/34125851/226595799-160b0da3-c9e0-4562-8544-5f20460f7cc9.png" width="2%" alt="" />
29
+ <a href="https://www.linkedin.com/company/pyresearch/" style="text-decoration:none;">
30
+ <img src="https://user-images.githubusercontent.com/34125851/226596446-746ffdd0-a47e-4452-84e3-bf11ec2aa26a.png" width="2%" alt="" /></a>
31
+ <img src="https://user-images.githubusercontent.com/34125851/226595799-160b0da3-c9e0-4562-8544-5f20460f7cc9.png" width="2%" alt="" />
32
+ <a href="https://twitter.com/Noorkhokhar10" style="text-decoration:none;">
33
+ <img src="https://user-images.githubusercontent.com/34125851/226599162-9b11194e-4998-440a-ba94-c8a5e1cdc676.png" width="2%" alt="" /></a>
34
+ <img src="https://user-images.githubusercontent.com/34125851/226595799-160b0da3-c9e0-4562-8544-5f20460f7cc9.png" width="2%" alt="" />
35
+ <a href="https://www.youtube.com/@Pyresearch" style="text-decoration:none;">
36
+ <img src="https://user-images.githubusercontent.com/34125851/226599904-7d5cc5c0-89d2-4d1e-891e-19bee1951744.png" width="2%" alt="" /></a>
37
+ <img src="https://user-images.githubusercontent.com/34125851/226595799-160b0da3-c9e0-4562-8544-5f20460f7cc9.png" width="2%" alt="" />
38
+ <a href="https://www.facebook.com/Pyresearch" style="text-decoration:none;">
39
+ <img src="https://user-images.githubusercontent.com/34125851/226600380-a87a9142-e8e0-4ec9-bf2c-dd6e9da2f05a.png" width="2%" alt="" /></a>
40
+ <img src="https://user-images.githubusercontent.com/34125851/226595799-160b0da3-c9e0-4562-8544-5f20460f7cc9.png" width="2%" alt="" />
41
+ <a href="https://www.instagram.com/pyresearch/" style="text-decoration:none;">
42
+ <img src="https://user-images.githubusercontent.com/34125851/226601355-ffe0b597-9840-4e10-bbef-43d6c74b5a9e.png" width="2%" alt="" /></a>
43
+ </div>
44
+
45
+ <hr>
46
+ """
47
+
48
+ st.markdown(html_content, unsafe_allow_html=True)
49
+
50
  # Model selection
51
  model_option = st.selectbox("Select Model", ["GPT-4 Turbo", "GPT-4 Vision", "DALL-E API", "Text-to-Speech (TTS)"])
52
 
 
103
  output_image = make_api_request(model_id, model_version_id, raw_text)
104
  st.image(output_image, caption='Generated Image', use_column_width=True)
105
 
106
+ # D