SectorMultiplayerChatServer / requirements.txt
awacke1's picture
Update requirements.txt
22099f6 verified
streamlit
# 🎨 Build interactive web apps: st.title("Hello"), st.button("Click"), st.image("pic.png")
# πŸ“Š Display data: st.dataframe(df), st.plotly_chart(fig), st.write("Text")
# πŸš€ Create UI: st.slider("Range", 0, 100), st.selectbox("Choose", options), st.file_uploader("Upload")
asyncio
# πŸ”„ Run async tasks: await asyncio.sleep(1), asyncio.run(main()), asyncio.gather(*tasks)
# 🌐 Handle coroutines: async def fetch(), await coro(), asyncio.create_task(func())
# ⏳ Manage event loops: loop = asyncio.get_event_loop(), loop.run_until_complete(), asyncio.ensure_future()
websockets
# 🌐 WebSocket server: async with websockets.serve(handler, "localhost", 8765): await asyncio.Future()
# πŸ“‘ Client connect: async with websockets.connect("ws://localhost:8765") as ws: await ws.send("Hi")
# πŸ”Š Real-time comms: async for msg in ws: print(msg), await ws.recv(), ws.send("Response")
pillow
# πŸ–ΌοΈ Load images: img = Image.open("file.png"), img.resize((100, 100)), img.save("out.png")
# 🎨 Process images: img.convert("RGB"), ImageDraw.Draw(img).text((10, 10), "Hello"), img.rotate(90)
# πŸ“Έ Manipulate: img.crop((0, 0, 50, 50)), img.filter(ImageFilter.BLUR), img.thumbnail((50, 50))
edge_tts
# πŸŽ™οΈ Text-to-speech: comm = edge_tts.Communicate("Hello", "en-US-AriaNeural"), await comm.save("out.mp3")
# πŸ”Š Customize voice: edge_tts.Communicate(text, voice="en-GB-SoniaNeural", rate="+10%"), await comm.save()
# πŸ“’ Generate audio: async def speak(text): await edge_tts.Communicate(text, "en-US-GuyNeural").save("file.mp3")
audio-recorder-streamlit
# 🎀 Record audio: audio_bytes = audio_recorder(), st.audio(audio_bytes, format="audio/wav")
# πŸ”‰ Capture voice: if audio_bytes: process_audio(audio_bytes), st.write("Recording...")
# πŸ“₯ Save recording: with open("recording.wav", "wb") as f: f.write(audio_recorder())
nest_asyncio
# πŸ”§ Fix nested loops: nest_asyncio.apply(), asyncio.run(main()), loop.run_until_complete(coro())
# 🌐 Enable async in sync: nest_asyncio.apply() before asyncio.run() in Jupyter/Streamlit
# ⏳ Patch event loop: import nest_asyncio; nest_asyncio.apply() for multiple event loops
streamlit-paste-button
# πŸ“‹ Paste images: result = paste_image_button("Paste"), if result.image_data: st.image(result.image_data)
# βœ‚οΈ Capture clipboard: paste_data = paste_image_button("Click"), st.write(paste_data.text_data)
# πŸ–ΌοΈ Process paste: if paste_image_button("Paste").image_data: save_image(result.image_data)
pypdf2
# πŸ“œ Read PDFs: reader = PdfReader("file.pdf"), text = reader.pages[0].extract_text(), num_pages = len(reader.pages)
# πŸ“ Extract text: for page in PdfReader("doc.pdf").pages: st.write(page.extract_text())
# πŸ“š Parse PDF: pdf = PdfReader(open("file.pdf", "rb")), st.write(pdf.metadata), page_count = len(pdf.pages)
anthropic
# πŸ€– AI responses: client = anthropic.Anthropic(api_key="key"), resp = client.messages.create(model="claude-3", messages=[...])
# πŸ“’ Claude chat: msg = client.messages.create(model="claude-3-sonnet", max_tokens=1000, messages=[{"role": "user", "content": "Hi"}])
# πŸ” Query AI: response = client.completions.create(model="claude-2", prompt="Hello", max_tokens_to_sample=512)
openai
# 🧠 GPT queries: client = openai.OpenAI(api_key="key"), resp = client.chat.completions.create(model="gpt-4", messages=[...])
# πŸ“ Generate text: completion = openai.Completion.create(model="text-davinci-003", prompt="Write a story", max_tokens=100)
# πŸ”Š AI chat: chat = client.chat.completions.create(model="gpt-3.5-turbo", messages=[{"role": "user", "content": "Hello"}])
gradio-client
# 🌐 Call Gradio APIs: client = Client("user/repo"), result = client.predict("input", api_name="/predict")
# πŸ“‘ Remote inference: prediction = Client("awacke1/Arxiv-Paper-Search").predict("query", 10, "search", "model")
# πŸ” Fetch results: resp = client.predict(param1, param2, api_name="/endpoint"), st.write(resp)
python-dotenv
# πŸ”‘ Load env vars: load_dotenv(), api_key = os.getenv("API_KEY"), st.write(os.getenv("SECRET"))
# 🌍 Config from .env: from dotenv import load_dotenv; load_dotenv(); db_url = os.getenv("DB_URL")
# πŸ“‹ Secure secrets: load_dotenv(".env"), token = os.getenv("TOKEN"), client = SomeClient(token)
streamlit-marquee
# πŸŽ₯ Scrolling text: streamlit_marquee(content="Hello", background="#000", color="#FFF", font-size="20px")
# πŸ“£ Dynamic marquee: streamlit_marquee(content="News", animationDuration="10s", width="100%")
# 🌈 Styled ticker: streamlit_marquee(content="Update", background="#1E1E1E", lineHeight="30px")