Spaces:
Runtime error
Runtime error
Commit
·
653d710
1
Parent(s):
aacb2a1
adding ChatGPT to repo
Browse files
app.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# -*- coding: utf-8 -*-
|
2 |
+
"""TextToString.ipynb
|
3 |
+
|
4 |
+
Automatically generated by Colaboratory.
|
5 |
+
|
6 |
+
Original file is located at
|
7 |
+
https://colab.research.google.com/drive/1kqcUjAv-A2eaBXwzEAhDP--7MXYS2zZ3
|
8 |
+
"""
|
9 |
+
|
10 |
+
import openai
|
11 |
+
openai.api_key = "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"
|
12 |
+
def imagegenerator(title, amount, size):
|
13 |
+
response = openai.Image.create(
|
14 |
+
prompt=title,
|
15 |
+
n=amount,
|
16 |
+
size=size
|
17 |
+
)
|
18 |
+
image_url = response['data'][0]['url']
|
19 |
+
return image_url
|
20 |
+
|
21 |
+
def menu():
|
22 |
+
title = str(input("Input what kind of pictur that you want to generate"))
|
23 |
+
amount = int(input("Input the amount picture that you want to generate"))
|
24 |
+
size = str(input("Input the size pof the image you want to generate"))
|
25 |
+
return imagegenerator(title, amount, size)
|
26 |
+
|
27 |
+
menu()
|