This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mycompany.langsample; | |
import dev.langchain4j.agent.tool.Tool; | |
import dev.langchain4j.http.client.jdk.JdkHttpClient; | |
import dev.langchain4j.model.openai.OpenAiStreamingChatModel; | |
import dev.langchain4j.service.AiServices; | |
import dev.langchain4j.service.TokenStream; | |
import java.awt.BorderLayout; | |
import java.awt.GridLayout; | |
import java.awt.event.ActionListener; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mycompany.langsample; | |
import dev.langchain4j.agent.tool.Tool; | |
import dev.langchain4j.http.client.jdk.JdkHttpClient; | |
import dev.langchain4j.model.openai.OpenAiStreamingChatModel; | |
import dev.langchain4j.service.AiServices; | |
import dev.langchain4j.service.TokenStream; | |
import java.awt.BorderLayout; | |
import java.awt.Color; | |
import java.awt.Font; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.*; | |
import java.awt.*; | |
import java.awt.event.*; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Random; | |
import java.awt.geom.RoundRectangle2D; | |
public class BlockBreaker extends JFrame { | |
private GamePanel gamePanel; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.*; | |
import java.awt.*; | |
import java.awt.event.*; | |
public class SokobanGUI extends JPanel implements KeyListener { | |
private static final int TILE_SIZE = 50; | |
private static char[][] level = { | |
{'#', '#', '#', '#', '#', '#', '#', '#', '#'}, | |
{'#', '.', ' ', ' ', '$', ' ', ' ', '.', '#'}, | |
{'#', ' ', '#', ' ', ' ', ' ', '#', ' ', '#'}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Sokoban { | |
private static char[][] level = { | |
{'#', '#', '#', '#', '#', '#', '#', '#', '#'}, | |
{'#', '.', ' ', ' ', '$', ' ', ' ', '.', '#'}, | |
{'#', ' ', '#', ' ', ' ', ' ', '#', ' ', '#'}, | |
{'#', ' ', '$', ' ', '@', ' ', '$', ' ', '#'}, | |
{'#', '#', ' ', '#', ' ', '#', ' ', '#', '#'}, | |
{'#', ' ', '.', ' ', '$', ' ', ' ', '.', '#'}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package imagesearchwithclip; | |
import com.fasterxml.jackson.databind.ObjectMapper; | |
import java.io.IOException; | |
import java.io.UncheckedIOException; | |
import java.net.URI; | |
import java.net.http.HttpClient; | |
import java.net.http.HttpRequest; | |
import java.net.http.HttpResponse; | |
import java.util.Arrays; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gradio as gr | |
import io | |
import requests | |
from PIL import Image | |
import torch | |
from transformers import AutoImageProcessor, AutoModel, AutoTokenizer | |
HF_MODEL_PATH = 'line-corporation/clip-japanese-base' | |
tokenizer = AutoTokenizer.from_pretrained(HF_MODEL_PATH, trust_remote_code=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// based on https://github.com/karpathy/llama2.c/commit/411c5bd2db9a87e94e1bd1a6c7b7ca117adc4b01 | |
// at Sep 14, 2023 | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.UncheckedIOException; | |
import java.io.UnsupportedEncodingException; | |
import java.lang.foreign.Arena; | |
import java.lang.foreign.MemorySegment; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.*; | |
import java.awt.*; | |
import java.awt.event.*; | |
public class Calculator extends JFrame implements ActionListener { | |
private JTextField textField; | |
private JButton[] numberButtons; | |
private JButton[] operatorButtons; | |
private JButton clearButton; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* to run, use Java 22 or later | |
* java --enable-preview --source 22 SevenGame.java | |
*/ | |
import java.io.BufferedReader; | |
import java.io.InputStreamReader; | |
import java.io.PrintWriter; | |
import java.net.ServerSocket; | |
import java.nio.charset.Charset; | |
import java.util.ArrayList; |
NewerOlder