update
swadhinbiswas committed 2 years ago
9797f78
1 parent 6a96ae3
commit 9797f78
5 files changed
+38 -6
Showing 5 changed files+38-6
▼Toph.co/Alayna's Adventure Journey.py
+4-0
| @@ -0,0 +1,4 @@ | ||
1 | +inputnum=int(input()) | |
2 | +listnum=list(map(int,input().strip().split()))[:inputnum] | |
3 | + | |
4 | +print(max(listnum)) | |
0 | 5 | |
▼Toph.co/MSIS!.py
+0-4
| @@ -1,4 +0,0 @@ | ||
1 | - | |
2 | -class Solve: | |
3 | - def soluction(self,list1:List)->int: | |
4 | - pass | |
5 | 0 | |
▼Toph.co/Mysterious Sum.py
+3-0
| @@ -0,0 +1,3 @@ | ||
1 | +def solve_mestrioussum(num1:int,num2:int)->int: | |
2 | + sum=num1+num2 | |
3 | + | |
0 | 4 | |
▼Toph.co/Permutations and Divisors.py
+0-0
0 | 0 |
▼Toph.co/Reverseman.py
+31-2
| @@ -1,3 +1,32 @@ | ||
1 | -name=str(input()) | |
1 | +apikey="ZGpOQRCTTRBBpEcnplx7gN_9MfEvfddSpzngykmZ" | |
2 | +Accountid="0ddd9358ccb8fd61c7f19b3ded0395ef" | |
3 | +from flask import Flask, request, Response | |
4 | +import requests | |
5 | +import os | |
2 | 6 | |
3 | -print(name[::-1]) | |
7 | +app = Flask(__name__) | |
8 | + | |
9 | +CLOUDFLARE_ACCOUNT_ID = Accountid | |
10 | +CLOUDFLARE_API_TOKEN = apikey | |
11 | + | |
12 | +def run_ai_model(prompt): | |
13 | + url = f"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/run/@cf/lykon/dreamshaper-8-lcm" | |
14 | + headers = { | |
15 | + "Authorization": f"Bearer {CLOUDFLARE_API_TOKEN}", | |
16 | + "Content-Type": "application/json" | |
17 | + } | |
18 | + data = { | |
19 | + "prompt": prompt | |
20 | + } | |
21 | + response = requests.post(url, headers=headers, json=data) | |
22 | + response.raise_for_status() | |
23 | + return response.content | |
24 | + | |
25 | +@app.route('/fetch', methods=['GET']) | |
26 | +async def fetch(): | |
27 | + prompt = "cyberpunk cat" | |
28 | + image_data = run_ai_model(prompt) | |
29 | + return Response(image_data, content_type='image/png') | |
30 | + | |
31 | +if __name__ == '__main__': | |
32 | + app.run(host='0.0.0.0', port=5000) | |
4 | 33 | |